WordPress.org

Ready to get started?Download WordPress

Forums

Hiding sub-pages (11 posts)

  1. Dbo
    Member
    Posted 4 years ago #

    Well I don't know if that's exactly what they're called but the pages that have a main-page associated to them. I basically want to hide them from showing up on the menu. Right now I have the ''Send me a tip!'' linked to about (about is the main page) but I want to be able to hide it because it's going to ruin the simplicity of the menu once I add the 2 other pages linked to the about page. Is there any way to do this ?

    Website is http://www.triplecz.com

  2. MichaelH
    Member
    Posted 4 years ago #

    Menus usually use the template tag, wp_list_pages(), so use the exclude=X argument, where X is the id of the page you want to exclude.

    You may find that code in your theme's header.php.

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Plugin that show id numbers in admin:
    http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/

  3. Dbo
    Member
    Posted 4 years ago #

    I read the stuff and tried it out, this is what I put and unfortunately it isn't working :/

    <?php wp_list_pages('title_li=&depth=-1', 'exclude=2832'); ?>

    2832 is just an imaginary number I used and the title_li was already there (while I don't even know what that means, something about depth :P) but basically it's still there, any ideas why ?

  4. MichaelH
    Member
    Posted 4 years ago #

    What's the page id for the "send me a tip" page?

  5. Dbo
    Member
    Posted 4 years ago #

    Well I realised I had linked this to a main parent page, don't know if that mattered or not but I took it off to see if it would work and it didn't. The ID for the send me a tip page is 1258. What's happening now is that it just wont load the page but thats not what I'm looking for, I just don't want them to appear in the menu but still be accessible, as in I'm going to link them elsewhere.

  6. Dbo
    Member
    Posted 4 years ago #

    bump for some help :/

  7. MichaelH
    Member
    Posted 4 years ago #

    If your theme is using wp_list_pages to display the menu, and you don't want child pages, then this should work.

    <?php wp_list_pages('title_li=&depth=1'); ?>
  8. Dbo
    Member
    Posted 4 years ago #

    I should've thought about changing that variable, sorry about that. Thank you very much for the help though. I have one more question for you while you're here.

    If you visit the 404 page of the website (www.triplecz.com/404), I have options for the visitor to go to but I wanted to be able to provide a description in white right under it but everytime I skipped a line in the 404.php file to make it appear under the link it just ended up appearing beside the link and not under. Here's that part of the 404.php

    <p><b>Meanwhile, you could check out the other pages on the website. Here are your choices:</b></p>

    <p><b>- The traditional | Home</b></p>
    <p><b>- Cars that will definitely get you laid | Wallpapers</b></p>
    <p><b>- Guaranteed to make you laugh | About</b></p>

    How would I make it where I can write a little description type thing right under it instead of beside ?

  9. Dbo
    Member
    Posted 4 years ago #

    nvm the problem above, I solved it but for some reason my send a tip page is not working anymore and all I have is the simple code you gave me;

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

    I tried renaming it, redoing the page, nothing worked. any ideas ?

  10. Nutrawee
    Member
    Posted 4 years ago #

    Detach send me a tip from about and try

    <?php wp_list_pages('title_li=&depth=1&exclude=2832'); ?>

  11. Dbo
    Member
    Posted 4 years ago #

    zeally that worked and I am grateful but now I am trying to make the send me a tip page actually work because its not working anymore for some reason, do you have any ideas why ?

Topic Closed

This topic has been closed to new replies.

About this Topic