首页 文章

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

提问于
浏览
0

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

以供参考 .

www.inagercoil.com/futar

1 回答

  • 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
    

    访问此链接..

相关问题