承接 dartmoon/wordpress-disable-editor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dartmoon/wordpress-disable-editor

最新稳定版本:v1.1.4

Composer 安装命令:

composer require dartmoon/wordpress-disable-editor

包简介

Disable editor for specific templates, pages, posts, etc.

README 文档

README

This plugin allows you to disable the editor for some CPTs, templates or specific pages.

Installation

If you use a Roots Bedrock or a composer-based WordPress installation

composer require dartmoon/wordpress-disable-editor

If you use a normal WordPress installation

  1. Download and install a MU plugin loader that lets you use MU plugins that reside inside folders. For example you could use Bedrock Autoloader.

  2. Download the latest release of this plugin and extract it inside the mu-plugins folder of your WordPress installation.

Usage

Disable Gutenberg

add_filter('drtn/disable_gutenberg', function ($can_edit, $post_id, $post_type) {
    /**
     * Post types for which to enable Gutenberg
     */
    if ($post_type == 'post') {
        return true;
    }

    /**
     * Templates for which we need to disable Gutemberg
     */
    $excludedTemplates = [
        // 
    ];

    /**
     * Specific Post IDs for which we need to disable Gutenberg
     */
    $excludedIds = [
        //
    ];

    // Retrieve the template of the current post id
    $template = basename(get_page_template());
    return !(in_array($post_id, $excludedIds) || in_array($template, $excludedTemplates));
}, 10, 3);

Disable classic editor

add_filter('drtn/disable_editor', function ($can_edit, $post_id, $post_type) {
    /**
     * Post types for which to enable the classic editor
     */
    if ($post_type == 'post') {
        return true;
    }

    /**
     * Templates for which we need to disable the classic editor
     */
    $excludedTemplates = [
        // 
    ];

    /**
     * Specific Post IDs for which we need to disable the classic editor
     */
    $excludedIds = [
        //
    ];

    // Retrieve the template of the current post id
    $template = basename(get_page_template());
    return !(in_array($post_id, $excludedIds) || in_array($template, $excludedTemplates));
}, 10, 3);

License

This project is licensed under the MIT License - see the LICENSE.md file for details

统计信息

  • 总下载量: 237
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固