如何为wordpress主题新添加一组自定义分类
此功能文章类目纵向管理,在wordpress主题的使用中单线的文章分类可能不足以组织目前的文章类别,所以我们需要再添加一组新的分类功能,那下面的代码就可以轻松实现那说到底这个功能的使用场景是怎样的呢,通常情况下,这个功能只出现在专题中,也就是说,这个功能的延伸是专题开发。大家可以综合利用一下。
把以下代码复制到functions.php文本始就可以生效为一个topics的分类选项组,而且自动调用的文章列表及菜单中
161718192021222324252627282930313233343536//hook into the init action and call create_book_taxonomies when it firesadd_action( 'init', 'create_topics_hierarchical_taxonomy', 0 ); //create a custom taxonomy name it topics for your posts function create_topics_hierarchical_taxonomy() { // Add new taxonomy, make it hierarchical like categories//first do the translations part for GUI $labels = array('name' => _x( 'Topics', 'taxonomy general name' ),'singular_name' => _x( 'Topic', 'taxonomy singular name' ),'search_items' =>__( 'Search Topics' ),'all_items' => __( 'All Topics' ),'parent_item' => __( 'Parent Topic' ),'parent_item_colon' => __( 'Parent Topic:' ),'edit_item' => __( 'Edit Topic' ), 'update_item' => __( 'Update Topic' ),'add_new_item' => __( 'Add New Topic' ),'new_item_name' => __( 'New Topic Name' ),'menu_name' => __( 'Topics' ),); // Now register the taxonomy register_taxonomy('topics',array('post'), array('hierarchical' => true,'labels' => $labels,'show_ui' => true,'show_admin_column' => true,'query_var' => true,'rewrite' => array( 'slug' => 'topic' ),)); }wordpress主题
声卡驱动正常但是没有声音如何办?声卡驱动正常没声音的解决方法
英伟达显卡驱动如何退回到原来版本?英伟达显卡驱动退回到原来版
重装系统,电脑只有一个C盘如何创建分区
Defender提示错误应用程序MsMpEng.exe无法启动
电脑无法启动或仍在加载如何办?电脑无法启动或仍在加载的解决方
打印机驱动如何卸载删除?卸载打印机驱动干净的教程
电脑没网如何安装网卡驱动?教你没网如何安装网卡驱动的方法
系统32位和62位如何选择:详解它们之间的差异
电脑文件删不掉如何办?四种方法解决
任务管理器快捷键有哪些?任务管理器快捷键大全