• neocamel

    (@neocamel)


    I have a custom post type “Wine menu”, which I would like to sort the wines (custom posts), by their region(parent taxonomy) and the type of wine (child taxonomy). I have created and registered the custom taxonomies, but I can’t figure out how to output the custom posts in the loop in a way that they are displayed in a hierarchy like so:

    • Tuscany
    • Chianti
    • Chianti wine from tuscany #1 (post)
    • Chianti wine from tuscany #2 (post)
    • Piedmont
    • Barolo
    • Barolo wine from Piedmont (post)</li
    • Chianti
    • Chianti wine from Piedmont (post)

    Can someone please help? Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter neocamel

    (@neocamel)

    To clarify, my custom taxonomy is called “wine-menu-parts” and the taxonomy structure is like so:

    • Tuscany
    • Chianti
    • Piedmont
    • Barolo
    • Chianti
    Thread Starter neocamel

    (@neocamel)

    Ok I managed to get a bit farther. I’ve been about to output an unordered list displaying the hierarchical taxonomies with:

    <?php
    echo '<ul>';
    $args_list = array(
    	'taxonomy' => 'wine-menu-parts', // Registered tax name
    	'show_count' => true,
    	'hierarchical' => true,
    	'title_li' => '',
    	'echo' => '0',
    	'order' => 'DESC',
    );
    echo wp_list_categories($args_list);
    echo '</ul>';
    ?>

    But I’m still trying to figure out how to list the associated posts under each child taxonomy? Ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List posts by taxonomy hierarchy?’ is closed to new replies.