• I want to be able to post a particular Page but not have that page title show up in sidebar with the other page titles. Can this be done?

    Eric

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hello

    If you mean exclude a page link from the list of “pages”?

    Try this: <?php wp_list_pages(‘title_li=&exclude=1, 2, 3’); ?>

    Just change the numbers 1, 2, 3 to match the ID for the page you want to exclude. The example above would remove the links to pages 1, 2 and 3

    Thread Starter erusch

    (@erusch)

    Yes, that’s what I mean. Can you tell me where I place this code?

    Thread Starter erusch

    (@erusch)

    The page ID is 37, so I pasted:

    <?php wp_list_pages(‘title_li=&exclude=37’); ?>

    at the bottom of the index.php for the theme, but to no avail. Where else might I try?

    Eric

    Just open up your sidebar.php and look for the existing wp_list_pages() and then modify it.

    No, you should open your sidebar.php (in the theme folder) and edit that file – since you want to exclude it from your sidebar, right?
    The code should already be there (since your Pages are listed there), you just have to add the “exclude parameter”.
    More reading: https://codex.www.ads-software.com/Template_Tags/wp_list_pages

    Hello

    Yes, Viper007Bond and moshu are correct sidebar.php is where it’s at.

    I am sorry I did not provide more info as to where that piece of code is located. Let us know if you get it sorted, if not please post again.

    Though that link moshu gave should answer any questions you have. ??

    Thread Starter erusch

    (@erusch)

    Well, I suppose most would have it sorted by now. However…

    I think I’ve located the area to edit. This is how it looks now (before any attempt to modify)…

    • <div class=”widget”>
      <h2><?php echo __(‘Pages’); ?></h2>
      <?php wp_list_pages(‘sort_column=menu_order&title_li=’); ?>

    </div>

    I’ve made a number of attempts. Can you show me how it should look within this paste?

    Don’t touch anything else except this line:
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>

    and make it:
    <?php wp_list_pages('exclude=x,y,z&sort_column=menu_order&title_li='); ?>
    where x,y,z should be the page_id numbers to exclude. Notice the & after the last one!

    Thread Starter erusch

    (@erusch)

    Your instruction could not be more clear.

    The page ID is 37. I have replaced:

    <?php wp_list_pages(‘sort_column=menu_order&title_li=’); ?>

    with:

    <?php wp_list_pages(‘exclude=37&sort_column=menu_order&title_li=’); ?>

    and clicked “update file” and refreshed. Page title still showing.

    Strange isn’t it?

    1. Try Ctrl + F5 (hard refresh)
    2. Delete the cache folder under wp-content/

    Thread Starter erusch

    (@erusch)

    Nope. Thanks for trying though.

    Then I don’t know what to say. Any plugins that might interfere with the Pages? And a stupid question: are you sure you are editing the sidebar.php from the active theme?
    Maybe a link would help…

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Want to keep a new page title off sidebar’ is closed to new replies.