自定义帖子类型

时间:2015-09-27 12:05:02

标签: php html5 wordpress

我正在制作一个有多种自定义帖子类型的定制网站。但是,Yoast似乎没有在自定义帖子概述页面上显示任何关键字,描述字段(而不是单独的帖子本身)。

我花了很多时间用谷歌搜索解决方案但添加:

'public' => true
'hierarchical' => true,
'has_archive' => true,

尚未解决问题。请参阅下面的完整代码段:

register_taxonomy_for_object_type('category', 'portfolio'); // Register            Taxonomies for Category
register_taxonomy_for_object_type('post_tag', 'portfolio');
register_post_type('portfolio', // Register Custom Post Type
    array(
    'labels' => array(
        'name' => __('Portfolio', 'html5blank'), // Rename these to suit
         'singular_name' => __('Portfolio', 'html5blank'),
        'add_new' => __('Add New', 'html5blank'),
        'add_new_item' => __('Add New Item', 'html5blank'),
        'edit' => __('Edit', 'html5blank'),
        'edit_item' => __('Edit Item', 'html5blank'),
        'new_item' => __('New Item', 'html5blank'),
        'view' => __('View Item', 'html5blank'),
        'view_item' => __('View Item', 'html5blank'),
        'search_items' => __('Search Item', 'html5blank'),
        'not_found' => __('No Item', 'html5blank'),
        'not_found_in_trash' => __('No Item found in Trash', 'html5blank')
    ),
    'public' => true,
    'menu_icon' => 'dashicons-images-alt2',
    'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages
    'has_archive' => true,
    'supports' => array(
        'title',
    ), // Go to Dashboard Custom HTML5 Blank post for supports
    'can_export' => true, // Allows export in Tools > Export
    'taxonomies' => array(
        'post_tag',
        'category'
    ) // Add Category and Post Tags support
));

还有其他人遇到过这个问题吗?

1 个答案:

答案 0 :(得分:0)

请使用屏幕选项下拉菜单并确保选中Yoast SEO。

相关问题