• falp

    (@falp)


    Hello,

    This is my first website with wordpress so please excuse if my question is obvious.

    I want to create a navigation menu on the sidebar using wp_list_pages funtion, but instead of excluding certain pages I want to INCLUDE only certain pages. Is this possible?

    The reason for this is that as I add more pages to the site I constantly need to update my sidebar.php to exclude the new page ids.

    I thought of the possibility of creating a static menu linking directly to the pages in question, but then I loose the current_page_item class that is otherwise automatically added.

    Any pointers would be of great help.

    Thanks in advance,

    Frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Though it’s not documented well, wp_list_pages() appears to support the “include” parameter. So you can do something like this:
    wp_list_pages('include=4,8,15,16,23,42');
    To show only those pages. Not entirely sure how that would work, mind you, so the results may be unusual. Or they may not. Hard to say.

    Thread Starter falp

    (@falp)

    Thanks Otto42, I will try it out tomorrow morning.

    Cheers,

    Frank

    Thread Starter falp

    (@falp)

    Otto42,

    I tried out the include argument and it works like a treat. I updated the wiki page on the wp_list_pages function in the codex to include this argument.

    Cheers,

    Frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_list_pages, include parameter?’ is closed to new replies.