• I am using a modified version of the default (Kubrik) theme on my web site at https://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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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,
    https://codex.www.ads-software.com/Template_Tags/wp_list_pages

    Thread Starter fmueller

    (@fmueller)

    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Limited page list in Kubrik sidebar’ is closed to new replies.