wordpress创建你的第一个分类法页面

2021年3月2日 飞飞 阅读(1.14K)
知识付费主题,优惠促销中:xx-blog主题

之前介绍过自定义分类法函数register_taxonomy的一些参数,今天咱们来创建你的第一个自定义分类法页面,我这里就以xx-blog主题创建的小册为例说明

function create_xiaoce_menu()
{
$labels = array(
'name' => '小册创建',
'singular_name' => 'country',
'search_items' => '搜索',
'popular_items' => '热门',
'all_items' => '所有',
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => '编辑',
'update_item' => '更新',
'add_new_item' => '添加',
'new_item_name' => '小组名称',
'separate_items_with_commas' => '按逗号分开',
'add_or_remove_items' => '添加或删除',
'choose_from_most_used' => '从经常使用的类型中选择',
'menu_name' => '小册创建',
);

$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => '小册创建',
'public' => true,
'menu_position' => 5,
'exclude_from_search' =>false,
'supports' => array( 'title', 'editor', 'category', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'query_var' => true,
);
register_taxonomy( 'docs', 'doc', $args );
}

add_action('init','create_xiaoce_menu'); //必须把操作函数挂载到 init 钩子上

将上面的代码放到 function.php 中就可以在wordpress后台看到小册的分类了,并且可以添加对应的小册分类信息


关注微信公众号『xx主题网

第一时间了解最新网络动态
关注博主不迷路~

未经允许不得转载:xx主题网 » wordpress创建你的第一个分类法页面
分享到:

评论抢沙发

要发表评论,您必须先

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

扫码关注微信公众号

扫描关注xx主题网