Forums

[resolved] Combining wp_list_pages and wp_list_categories results (4 posts)

  1. serpico
    Member
    Posted 2 years ago #

    I would like to create a dynamic navigation menu which incorporates list results from both wp_list_pages and wp_list_categories. So that pages and categories can appear in the same menu. I do not want to have to create a list for both separately. Is this possible? Does a function exist?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Will offer another alternative in case you don't get an answer:
    How to easily display links to both Pages and Categories in the blog navigation header?

  3. serpico
    Member
    Posted 2 years ago #

    Cheers MichaelH - that will solve for now. Didn't think an actual function existed which would display both pages and category results anyway... unless I coded it myself. Perhaps a plugin for the future.

  4. alchymyth
    The Sweeper
    Posted 2 years ago #

    because both echo list items <li>, you shold be able to stick them into the same unordered list:
    for example:

    <ul role="navigation">
    <?php wp_list_pages('title_li=' ); ?>
    <?php wp_list_categories('show_count=1&title_li='); ?>
    </ul>

    obviously, that won't mix the items, or sort them, so there will be the pages first in the menu, followed by categories.
    untested ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic