Forums

Want to keep a new page title off sidebar (13 posts)

  1. erusch
    Member
    Posted 5 years ago #

    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

  2. BPartch
    Member
    Posted 5 years ago #

    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

  3. erusch
    Member
    Posted 5 years ago #

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

  4. erusch
    Member
    Posted 5 years ago #

    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

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

  6. moshu
    Member
    Posted 5 years ago #

    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: http://codex.wordpress.org/Template_Tags/wp_list_pages

  7. BPartch
    Member
    Posted 5 years ago #

    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. :)

  8. erusch
    Member
    Posted 5 years ago #

    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)...

  9. <div class="widget">
    <h2><?php echo __('Pages'); ?></h2>

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

    </div>

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

  • moshu
    Member
    Posted 5 years ago #

    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!

  • erusch
    Member
    Posted 5 years ago #

    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?

  • moshu
    Member
    Posted 5 years ago #

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

  • erusch
    Member
    Posted 5 years ago #

    Nope. Thanks for trying though.

  • moshu
    Member
    Posted 5 years ago #

    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...

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.