Support » Fixing WordPress » how can I prevent some page links from showing in the sidebar/header?

  • Hi all,
    I have created several pages in WP 201 and using modern theme from ( In this particular theme, it adds the newly created page links in header.php (i think it goes in header.php instead of sidebar.php).

    My wish is not to show some pages hyperlinks in the navigation. How can I do that?

    Any help please?


Viewing 6 replies - 1 through 6 (of 6 total)
  • In header.php look for this line or similar”

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

    All themes aren’t the same, but adjusting this should work.

    You could probably get a more specific resolution at your author’s theme site if you’re not comfortable working with php.


    It’ll look like that if you want to exclude some pages… just replace the X’s with the page numbers, you can find those on your manage > pages section.

    Awesome the later code ‘exclude’ worked. Made my day!.

    Thanks a bunch.

    I got two more questions, though.

    1. how can I safely remove ‘posts’ and ‘comments’ sections (or atleast disable so as not to see in the site) and also ‘categories’ link in the sidebar.php?

    I tried taking some codes out with my limited knowledge. but it messed up some of my layout.

    The index.php has the follwoing lines:

    <?php get_header(); ?>

    <div id=”content”>
    <p align=”justify”>some stuff that i have here….

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <p class=”postmetadata”><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>

    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>

    <p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’,”,’|‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>

    <?php else : ?>

    <h2>Not Found</h2>
    Sorry, but you are looking for something that isn’t here.
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?>


    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    2. How can i add an external link (pointing to some other html page) in sidebar?

    Sorry to continue in the same thread.

    Please help.



    the first question, i’m not sure exactly what you are asking. What are you trying to do with the page?

    the second question, all you have to do is go into your theme editor and edit the sidebar by adding the link wherever you would like if you don’t want to use the built in link section for your side bar. the code will look exactly the same as when you put a link in a post/page.

    Sorry, even I got confused after reading my post.

    I’ll try to be clear.
    what I am trying to is not to show the posts, comments on index page when somebody visits the blog. It should just have the
    <div id=”content”>
    <p align=”justify”>some stuff that i have here….

    <?php get_header(); ?>

    Then when somebody clicks on categories, or archives, they should be able to see the posts.

    So on the whole, no posts, comments, etc on

    Is that possible?

    (probably I will look for some ‘top 5 recent posts’ plugin elsewhere to display the list in sidebar.



    But the posts, comments section should be functional.

    i think your best bet is to not do all that and just use one of the plugins that lets you use a static page as your home page…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how can I prevent some page links from showing in the sidebar/header?’ is closed to new replies.