多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
【插件注释】: ~~~ <?php /** *Plugin Name: Basic Plugin *Plugin URI: *Author: Neo *Author URI: *Version: 1.1 *License: GPLv2 */ ~~~ 如图所示: ![](https://box.kancloud.cn/1b8d0f8f85ebdca054ac81ae1a8af124_604x72.png) 【当前窗口弹出的链接】: ~~~ <?php /** *Plugin Name: Basic Plugin *Plugin URI: *Author: Neo *Author URI: *Version: 1.1 *License: GPLv2 */ function dwwp_add_google_link() { global $wp_admin_bar; $wp_admin_bar->add_menu(array( 'id'=> 'google_analytics', 'title' => 'Google Analytics', 'href' => 'http://google.com/analytics', 'target' => '' )); } add_action('wp_before_admin_bar_render', 'dwwp_add_google_link'); ~~~ 如图所示: ![](https://box.kancloud.cn/bfaf3e34c415ebbf05249fd7963deb82_252x37.png) 【Book Post Type】 ~~~ <?php /** *Plugin Name: Book Post Type *Plugin URI: *Author: Neo *Author URI: *Version: 1.1 *License: GPLv2 */ //book post type function cptui_register_my_cpts_book() { /** * Post Type: book. */ $labels = array( "name" => __( "book", "twentyseventeen" ), "singular_name" => __( "book", "twentyseventeen" ), "menu_name" => __( "book", "twentyseventeen" ), ); $args = array( "label" => __( "book", "twentyseventeen" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "has_archive" => false, "show_in_menu" => true, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => array( "slug" => "book", "with_front" => true ), "menu_icon" =>"dashicons-welcome-write-blog", "query_var" => true, "supports" => array( "title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "author", "page-attributes", "post-formats" ), "taxonomies" => array( "category", "post_tag" ), ); register_post_type( "book", $args ); } add_action( 'init', 'cptui_register_my_cpts_book' ); ~~~ 如图所示: ![](https://box.kancloud.cn/064c4817a2381fe7d5b686e6259b0c48_464x303.png) 【参考】: wordpress menu_icon: <a href="https://developer.wordpress.org/resource/dashicons/#welcome-write-blog" target="_blank">https://developer.wordpress.org/resource/dashicons/#welcome-write-blog</a>