Forums

[resolved] a hierarchical list of all categories, with linked post titles (3 posts)

  1. akallen
    Member
    Posted 1 year ago #

    I am trying to create a list of categories ordered by id, the description and all posts in the categories. Here is the code: http://pastebin.com/9XeeTW4m and my page: http://www.allenwebcreation.com/public_html/wp/research-our-collections2/.

    How do I change the code so that the categories are ordered by id instead of alphabetically?

    Thanks!

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    http://codex.wordpress.org/Function_Reference/get_categories

    use the 'orderby' and 'order' parameter;

    try to change (line 10):

    foreach( get_categories('hide_empty=false&exclude=1,7,15,26&orderby=id&order=asc') as $cat ) :

    and (line 23):

    $next = get_categories('hide_empty=false&parent=' . $cat . '&orderby=id&order=asc');

    hope it works; good luck ;-)

  3. akallen
    Member
    Posted 1 year ago #

    Thanks alchymyth, that did the trick!

Topic Closed

This topic has been closed to new replies.

About this Topic