自定义帖子Wordpress-Public布尔值

时间:2015-07-25 06:41:17

标签: php wordpress boolean public

我们有一个自定义帖子类型(在本例中称为“item”),我们只希望为网站成员提供这些类型。我们将布尔值“public”从“true”更改为“false”,但这会使自定义帖子甚至对用户不可用。有没有选项让自定义帖子仅供会员使用?

    register_post_type('item', Array(
        'public'                => true,
        'menu_icon'             => '',
        'labels'                => $labels,
        'supports'              => Array(
            'title', 'editor', 'thumbnail',
        ), 'rewrite'            => array('slug' => $javo_item_slug , 'with_front' => false )
        , 'query_var'           => true
        , 'taxonomies'          => Array( 'post_tag')
    ));
        // item > Category
        register_taxonomy('item_category', 'item', Array(
            'label'             => __( 'Item Category', "javo_fr" )
            , 'labels'          => Array(
                'menu_name'     => __('Category', 'javo_fr')
            )
            , 'rewrite'         => array( 'slug' => $javo_item_slug.'_category' )
            , 'hierarchical'    => true
        ));
        // item > location
        register_taxonomy('item_location', 'item', Array(
            'label'             => __( 'Item Location', "javo_fr" )
            , 'labels'          => Array(
                'menu_name'     => __('Location', 'javo_fr')
            )
            , 'rewrite'         => array( 'slug' => $javo_item_slug.'_location' ),
            'hierarchical'      => true,
        ));

        // Custom label for Post Tags
        $wp_taxonomies['post_tag']->labels = (object) Array(
            "name"                          => __('Keywords', 'javo_fr')
            , "singular_name"               => __('Keyword', 'javo_fr')
            , "search_items"                => __('Search Keywords', 'javo_fr')
            , "popular_items"               => __('Popular Keywords', 'javo_fr')
            , "all_items"                   => __('All Keywords', 'javo_fr')
            , "parent_item"                 => NULL
            , "parent_item_colon"           => NULL
            , "edit_item"                   => __('Edit Keyword', 'javo_fr')
            , "view_item"                   => __('View Keyword', 'javo_fr')
            , "update_item"                 => __('Update Keyword', 'javo_fr')
            , "add_new_item"                => __('Add New Keyword', 'javo_fr')
            , "new_item_name"               => __('New Keyword Name', 'javo_fr')
            , "separate_items_with_commas"  => __('Separate keywords with commas', 'javo_fr')
            , "add_or_remove_items"         => __('Add or remove keywords', 'javo_fr')
            , "choose_from_most_used"       => __('Chose from the most used keywords', 'javo_fr')
            , "not_found"                   => __('No keywords found', 'javo_fr')
            , "menu_name"                   => __('Keywords', 'javo_fr')
            , "name_admin_bar"              => "post_tag"
        );

0 个答案:

没有答案