WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Exclude "Home" from Menu ? (8 posts)

  1. leahs2
    Member
    Posted 3 years ago #

    I'm trying to use the exclude feature with wp_list_pages and I want to exclude my Home page from the menu, but my home page has no page ID. How do I tell wordpress to exclude a page with no page ID from the list pages?

    Thanks!

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    it's probably just coded into your menu separately..

    you could comment out/delete it from your nav

    similar to:
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>

  3. leahs2
    Member
    Posted 3 years ago #

    Thanks for the quick response. I'm a little new to php. I can figure out where to place it in the nav, but I sense I need to replace bloginfo('url') with something. Can you give me the full code if I tell you my site is leahschrager.com/wordpress?

    thanks!

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    do you see in your header.php file, the code your menu is being generated from?

    the code I posted above is something you would need to delete or comment out.....

    if you can find your navigation code, I could tell you more specifically

    it'll start like <ul id="nav"> and end with </ul>

    paste that here....

    Also, offtopic, you have some real goofy code showing up in your source code.....

    <body>
    <table width="900" border="0" align="center" class="table">
    <tr>
    <td class="background"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> 
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="generator" content="WordPress 2.9.2" /> 
    
    <title>Leah S </title>

    not sure where that's coming from.... but it shouldn't be showing in the <body> section of your theme..?

    you can see it in context here
    http://validator.w3.org/check?uri=http%3A%2F%2Fleahschrager.com%2Fwordpress%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator%2F1.767#line-19

    things get real strange around line 19....

  5. leahs2
    Member
    Posted 3 years ago #

    thanks. i'll look into that goofy code :-)

    Here is the nav code:
    <ul id="nav">
    <?php wp_list_pages('title_li=&depth=1'); ?>

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    that's all you have? the very next line is </ul>?

    because Home is not hardcoded in that little bit of code, so I would think it would be a page then.....

  7. leahs2
    Member
    Posted 3 years ago #

    I think so. This is the code for my header.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

    <title><?php bloginfo('name'); ?> <?php wp_title('—'); ?></title>

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

    <?php wp_head(); ?>
    </head>

    <body>
    <div id="page">

    <div id="header"> <img src="http://leahschrager.com/wordpress/wp-content/themes/infimum/images/header2.jpg" alt="" width="880" height="100" />

    <ul id="nav">
    <?php wp_list_pages('title_li=&depth=1'); ?>

    <?php if($post->post_parent)
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");

    if ($children && is_page()) { ?>
    <ul id="subnav">
    <?php echo $children; ?>

    <?php } else { ?>
    <?php } ?>
    </div>

    </div>

    The permalink for the home page is:
    http://leahschrager.com/wordpress/

    Thanks so much!!

  8. leahs2
    Member
    Posted 3 years ago #

    well, i ended up using this plugin:
    http://wordpress.org/extend/plugins/exclude-pages/

    and not including the "home". thereby avoiding coding. and it worked.

    thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.