• I’m sure there is an easy fix/workaround for this. Basically I want to be able to create pages that don’t show up on my Pages widget. How do you keep them from being listed there? Maybe it’s a different add-on that I need to create pages with instead of the regular pages spot in the admin section. Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you using the Pages widget in Admin/Appearance/Widgets? If so, there’s an exclude field. Add the ids of any pages you want to exclude (separated by commas) to this box.

    https://quirm.net/2009/06/24/finding-wordpress-post-ids/

    If you aren’t using any widgets, you’ll need to edit your sidebar template file, look for wp_list_pages() and amend it to wp_list_pages(exclude=nn’)` – where nn= is a list of page ids (again separated by commas) that you want to exclude.

    Thread Starter allg33k

    (@allg33k)

    Excellent you answered my next question without me posting it. Your answer did exactly what I needed it to do. However the theme I’m using is also displaying the pages at the top of the page. I was assuming the widget would control that list too, however it doesn’t appear that way. So I’m assuming I need to look in the header for how it’s pulling that list: wp_list_pages and see if I can add your exclude in there.

    ….almost worked. I’m sure this just comes down to a comma or something. Here’s where it’s at in the header:

    <?php if ( get_theme_mod( ‘cat_nav’ )) { wp_list_categories(‘title_li=&depth=1’ ); } else { wp_list_pages(‘title_li=&depth=1’ ); } ?>

    And I tried to do this:

    <?php if ( get_theme_mod( ‘cat_nav’ )) { wp_list_categories(‘exclude=12,24; title_li=&depth=1’ ); } else { wp_list_pages(‘exclude=21,24 title_li=&depth=1’ ); } ?>

    It appears to disregard the title_li part then. So I’m guessing you can’t put two things inside the () or I’m using a ; instead of something else. Any help?

    It appears to disregard the title_li part then. So I’m guessing you can’t put two things inside the ()

    You can have a whole string of different parameters in there if you remember to join them using &.

    Try:

    <?php if ( get_theme_mod( 'cat_nav' )) { wp_list_categories('title_li=&depth=1&exclude=12,24' ); } else { wp_list_pages('title_li=&depth=1&exclude=21,24' ); } ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pages Widget: Hiding Pages’ is closed to new replies.