[wordpress插件] Devel开发

wordpress 插件 文章 2020-04-16 02:50 578 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Devel is made up of development oriented administrative components for developers and power users who need more control over their WordPress site.

Devel 由面向开发的管理组件组成,面向需要对WordPress网站进行更多控制的开发人员和高级用户。

Features are seperated into components which can be enabled or disabled.

功能分为可启用或禁用的组件。

In addition, devel has an intuitive API for adding your own custom components into the mix using the devel components API.

此外,devel具有直观的API,可使用devel组件API将自己的自定义组件添加到混合中。

Bundled Components

捆绑的组件

By default, devel comes packaged with:

默认情况下,devel随附于:

    • Custom Fields Manager – Allows to you manage all custom fields in your site.
    • 自定义字段管理器 –允许您管理站点中的所有自定义字段。

    Additional components will be added gradually throughout future releases.

    在将来的发行版中将逐渐添加其他组件。

    If you have any component suggestions, please visit the forums.

    如果您有任何组件建议,请访问论坛

    Components API

    组件API

    Using the components API, you can add your own components to devel.

    使用组件API,您可以将自己的组件添加到开发中。

    Add a component:

    添加组件:

    add_action( 'devel_register_components', 'register_my_components' );

      add_action('devel_register_components','register_my_components');

    function register_my_components() {    

    函数register_my_components(){    

    register_devel_component( array( 'id' => 'debug', 'label' => 'Debug', 'callback' => 'debug_callback', 'description' => 'This is a custom component.' ) );

    register_devel_component(array('id'=>'debug','label'=>'Debug','callback'=>'debug_callback','description'=>'这是一个自定义组件。'));

    }

    }

    In your callback function:

    在您的回调函数中:

    function debug_callback() {    

      function debug_callback(){    

    if ( is_active_devel_component( 'debug' ) ) {        

    如果(is_active_devel_component('debug')){        

    require_once( TEMPLATEPATH . '/devel-component-debug.php' );    

    require_once(TEMPLATEPATH。'/devel-component-debug.php');    

    }

    }

    }

    }

    In devel-component-debug.php you can hook into the devel menu:

    devel-component-debug.php 中,您可以进入开发菜单:

    add_action( 'admin_menu', 'custom_fields_init' );

      add_action('admin_menu','custom_fields_init');

    function custom_fields_init() {    

    函数custom_fields_init(){    

    add_submenu_page( 'devel', 'Debug', 'Debug', 'manage_options', 'debug-component', 'debug_admin_page' );

    add_submenu_page('devel','Debug','Debug','manage_options','debug-component','debug_admin_page');

    }

    }

    function debug_admin_page() { ?>    

    函数debug_admin_page(){?>    

            

            

    <?php screen_icon('tools');

    ?>        

    ?>        

    Debug

        

    调试    

        

        

    <?php

    }

    }

安装步骤

    1. Upload ‘devel’ to the ‘/wp-content/plugins/’ directory.
    2. 将“开发”上传到“ / wp-content / plugins /”目录。

    3. Activate the plugin through the Plugins menu in WordPress.
    4. 通过WordPress中的插件菜单激活插件。

    5. Go to Devel > Devel Components and activate any components you want.
    6. 转到开发>开发组件并激活所需的任何组件。

下载地址
https://downloads.wordpress.org/plugin/devel.zip
-EOF-

AI助手支持GPT4.0