WordPress.org

Ready to get started?Download WordPress

Forums

Limited page list in Kubrik sidebar (3 posts)

  1. fmueller
    Member
    Posted 6 years ago #

    I am using a modified version of the default (Kubrik) theme on my web site at http://www.fmueller.com. The line '<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>' in sidebar.php lists ALL of my pages in the sidebar. I'd like to list only some of these pages to turn it into a more useful navbar, and I know that a command exists to do that, because I had it set up like that before I stupidly overwrote my whole theme folder without keeping a backup :( If anybody could refresh my memory on how to make it list only a few selected pages in the sidebar, I would be most grateful!

  2. Len
    Member
    Posted 6 years ago #

    You can use the exclude argument to omit any pages you want. For instance, you're using this to display pages...

    <?php
    wp_list_pages('title_li='); ?>

    ...and you want to exclude a particular page. Look for that page ID and insert it into the command as such...

    <?php
    wp_list_pages('title_li=&exclude=20' ); ?>

    This will exclude page #20 from being displayed. More here,
    http://codex.wordpress.org/Template_Tags/wp_list_pages

  3. fmueller
    Member
    Posted 6 years ago #

    Thanks so much! I prefer using the include argument because the number of pages I want to list is small compared to the ones I don't want to list. If I use include, I only have to edit sidebar.php on the rare occasion that I create a new page I want to list. If I use exclude, I need to edit sidebar.php every single time I create a page that I don't want to list, which is far more often. Luckily your link to the codex explained the include argument right next to the exclude argument, so again, many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic