当我尝试向菜单添加链接时,收到以下消息:
我已经创建了自定义帖子类型和自定义分类法
<?php
/*
Plugin Name: Portfolio - Custom Post Type
Plugin URI:
Description:
Version: 1.0
Author:
Author URI:
License:
*/
?>
<?php
// ----- Register custom post type ------ //
add_action( \'init\', \'create_post_type_portfolio\' );
function create_post_type_portfolio() {
$labels = array(
\'name\' => _x( \'Portfolios\', \'post type general name\' ),
\'singular_name\' => _x( \'Portfolio\', \'post type singular name\' ),
\'add_new\' => _x( \'Add New\', \'job\' ),
\'add_new_item\' => __( \'Add New Portfolio item\' ),
\'edit_item\' => __( \'Edit Portfolio Item\' ),
\'new_item\' => __( \'New Portfolio Item\' ),
\'all_items\' => __( \'All Portfolio Items\' ),
\'view_item\' => __( \'View Portfolio Item\' ),
\'search_items\' => __( \'Search Portfolio Items\' ),
\'not_found\' => __( \'No Portfolio Items found\' ),
\'not_found_in_trash\' => __( \'No Portfolio Items found in the Trash\' ),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Portfolio Items\'
);
$args = array(
\'labels\' => $labels,
\'description\' => \'Holds our Portfolio Items and Portfolio Item specific data\',
\'public\' => true,
\'menu_position\' => 5,
\'menu_icon\' => plugins_url( \'portfolio.png\', __FILE__ ),
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'excerpt\', \'comments\' ),
\'has_archive\' => true,
\'show_in_nav_menus\' => true,
\'rewrite\' => true,
\'show_ui\' => true,
);
register_post_type( \'portfolio\', $args );
}
// ------------- register taxonomy ----------------- //
// hook into the init action and call create_portfolio_taxonomies when it fires
add_action( \'init\', \'create_portfolio_taxonomies\', 0 );
// create Work for the post type "portfolio"
function create_portfolio_taxonomies() {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
\'name\' => _x( \'Work\', \'taxonomy general name\' ),
\'singular_name\' => _x( \'Work\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search Work\' ),
\'all_items\' => __( \'All Work\' ),
\'parent_item\' => __( \'Parent Work\' ),
\'parent_item_colon\' => __( \'Parent Work:\' ),
\'edit_item\' => __( \'Edit Work\' ),
\'update_item\' => __( \'Update Work\' ),
\'add_new_item\' => __( \'Add New Work\' ),
\'new_item_name\' => __( \'New Work Name\' ),
\'menu_name\' => __( \'Work\' ),
);
$args = array(
\'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'query_var\' => true,
\'show_in_nav_menus\' => true,
\'rewrite\' => array( \'slug\' => \'work\' )
);
register_taxonomy( \'Work\', array( \'portfolio\' ), $args );
}
?>
为什么?