菜单中的wordpress类别子类别页面列表

时间:2015-04-09 12:53:04

标签: wordpress categories custom-taxonomy

我需要在wordpress菜单中动态列出所有父类和子类,以及当每个点击它应该转到新页面时,shud列出帖子属于这些类别,请告诉我如何做到这一点< / p>

供参考。

www.inagercoil.com/futar

1 个答案:

答案 0 :(得分:0)

使用此功能

<?php 
    $args = array(
    'show_option_all'    => '',
    'orderby'            => 'name',
    'order'              => 'ASC',
    'style'              => 'list',
    'show_count'         => 0,
    'hide_empty'         => 1,
    'use_desc_for_title' => 1,
    'child_of'           => 0,
    'feed'               => '',
    'feed_type'          => '',
    'feed_image'         => '',
    'exclude'            => '',
    'exclude_tree'       => '',
    'include'            => '',
    'hierarchical'       => 1,
    'title_li'           => __( 'Categories' ),
    'show_option_none'   => __( '' ),
    'number'             => null,
    'echo'               => 1,
    'depth'              => 0,
    'current_category'   => 0,
    'pad_counts'         => 0,
    'taxonomy'           => 'category',
    'walker'             => null
    );
    wp_list_categories( $args ); 
?>

并在此功能中

hierarchical 
(boolean) Display sub-categories as inner list items (below the parent list item) or inline. The default is true (display sub-categories below the parent list item). Valid values:
1 (True) - Default
0 (False)

为每个类别点击新页面访问与所属职位

Displays a list of Categories as links. When a Category link is clicked, all the posts in that Category will display on a Category Page using the appropriate Category Template dictated by the Template Hierarchy rules.

了解更多信息

https://codex.wordpress.org/Template_Tags/wp_list_categories

访问此链接..