Wordpress中的无效分类法

时间:2018-09-06 08:26:22

标签: wordpress wordpress-theming

我要添加完整的代码。请查看我的代码,找出错误的原因(无效的分类法)。我在子主题功能文件(而非插件文件)中使用此代码。

add_action('init', 'portfolio_register');
    function portfolio_register() {
        $labels = array(
                    'name' => _x( 'Portfolio', 'taxonomy general name', 'textdomain' ),
            'singular_name'     => _x( 'Portfolio Item', 'taxonomy singular name', 'textdomain' ),
            'add_new' => _x('Add New', 'portfolio item'),
            'add_new_item' => __('Add New Portfolio Item'),
            'edit_item' => __('Edit Portfolio Item'),
            'new_item' => __('New Portfolio Item'),
            'view_item' => __('View Portfolio Item'),
            'search_items' => __('Search Portfolio'),
            'not_found' =>  __('Nothing found'),
            'not_found_in_trash' => __('Nothing found in Trash'),
            'parent_item_colon' => ''
                );

        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'query_var' => true,
            'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
            'rewrite' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array('title','editor','thumbnail')
          ); 
        register_post_type( 'portfolio' , $args );
            add_action( 'init', 'register_taxonomy' );
    register_taxonomy(
            "skills", 
            array("portfolio"), 
            array("hierarchical" => true, 
                "label" => "skills", 
                "singular_label" => "Skill", 
                "rewrite" => true)
            );
    }

enter image description here

0 个答案:

没有答案