Support » Fixing WordPress » How can I hide a page ?

  • I posted and earlier question “sidebar on separate page” but due to lack of responses, maybe that’s impossible to code.

    So my new question is this:

    How can I prevent a certain page that was created with the “Create Pages” option in WP 1.5 from being displayed in the sidebar under the “Pages” section.


    From this:


    Heading South
    Last Winter
    Ready To Travel

    To this:


    Heading South
    Last Winter
    Ready To Travel

    In other words, the Menu page still exists in the database, you can link to it from a navigational menu, you can display the sidebar info in the menu page, …


    The page itself is not displayed on the index page under the “Pages” section.

    Is this possible to do ?


Viewing 15 replies - 1 through 15 (of 24 total)
  • rvblog,
    I don’t think your primary request is impossible to do. Given the high traffic on the forums these days, it seems that some threads are disappearing off of the radar rather quickly.

    How can I find out how to do it ?


    Where can I go to read up on it?

    Because I don’t know how to do what I’m trying to accomplish, I don’t know what I should be searching for on the internet in order to find the necessary articles or information that I need to explain the steps that I need to take.

    I suspect you can do it with php ? “if” something – “then not” something else – and all that stuff.

    If someone can set me off in the right direction, I would appreciate it.


    I read the link at and it doesn’t look like it applies in my case.

    In that article, he talks about being able to load different templates based on the type of query being made – but it is still based on either a post or a page being created beforehand.

    For the templates that he talks about to work you need to have a page created (static or virtual) or a post entered into the database in order to call the template and display it.

    I made various templates, all with no problem at all.

    I made one called menu.php that included the “get header.php”, “get footer.php”, and it also included the “get sidebar.php” which is what I want to do. I also created a link on a navigational bar to link to the page called menu. Everything worked fine except for one thing:

    The only problem with that (and that’s what I’m trying to prevent) is this new menu page is listed under the “Page Section” (in the WP 1.5 default Kubrick theme) with all the other article pages and all the other sidebar info.

    I’m trying to create a menu page to act like a sort of content or index page but I don’t want it to be listed with all the rest of my virtual article pages. I do not want that menu page to be listed or visible on any page. I just want to click on the navbar button and a page appear with all the sidebar stuff included.

    Instead of a dual column page with post section on the left and sidebar section on the right, I want a single column page with index on one page and the sidebar on another page. But ideally, I would like the menu.php to function just like an index.php file.

    I’ve tried to create a situation where, when I type in, I get a page with the sidebar info in it. Everything I’ve tried so far gives me a 404 error page when I try to access the menu.php file.

    If you created a page in WP1.5 named “menu” using WPs page feature, then your actual URL would be

    Unfortunately, after looking at the WP source, there doesn’t seem to be an easy way to hide a page currently. I’m looking into adding the exclude argument from wp_list_cats to the wp_list_pages routine though, to see if it works 🙂

    Yes, that’s exactly how it works. The ~` is actually a link to a virtual page that was created and is located in the database. It is not a menu.php like the index file is.

    I’m glad you understand what i’m trying to do and i look forward to that exclusion feature being added if it is at all possible. Other people may also have the need to hide certain pages for various reasons.

    How will I know if and when the exclusion feature is added to the wp_list_pages routine. Is the another forum to watch for it?


    I’m a liar!

    The tag you call from your template, wp_list_pages, will accept an exclude parameter 🙂

    So, in your admin interface, look up the ID number of the page you want to make invisible, then change the tag from:
    <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
    <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>&exclude=69' ); ?>
    for example 🙂

    The exclude support was already in the routine, just buried a little compared to the wp_list_cats one so I didn’t see it until I started digging for the thing 🙂


    I would still like to know ( if for anything else but to satisfy my curiousity):

    Can a menu.php be coded in such a way to act like an index.php file so that you can link to it without having to create a static or virtual page ??

    Much like an index.php file calls the sidebar.php – have a menu.php call the sidebar.php instead.

    Sorry, I was posting as you were replying.

    Thank you very, very much for the info – you just alleviated a big headache that’s been hounding me for days.

    Much appreciated, and I’ll give your answer a try.

    Take care.

    Create a template file in your theme folder and name it menu.php (any name is good, really). It should contain the following lines:

    Template Name: Menu

    <?php get_header(); ?>

    <div id="content" class="widecolumn">

    <?php get_sidebar(); ?>


    <?php get_footer(); ?>

    (this is using the 1.5 default template as an example).

    Then, in the admin section, create a new page (or edit the menu page you’ve already created there), and change the template to menu. Viola 🙂

    I think….

    Thanks, and yes, you’re right. That works because I already tried it. It was just the exclude code that I knew nothing about. Know I know thanks to you.

    (note: I eliminated reference to class=”widecolumn” because I’m converting the 1.5 default Kubrick into a one column layout)

    And thanks to everyone else who shared in my question. Someday, I’ll be able to return the help

    Someone just sent me a message telling me that I did help out by asking the question in the first place.



    How would I exclude 2 different pages?

    Say for pages with ID 69 and 96 ? – Like this ?

    <?php wp_list_pages(‘title_li=<h2>’ . __(‘Pages’) . ‘</h2>&exclude=69′, 96’ ); ?>

    I think that this thread would work really well as an addition to Codex!

    RustIndy…would you be willing to take a crack at it?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘How can I hide a page ?’ is closed to new replies.