• Resolved drumz

    (@drumz)


    I cannot get the custom menu to work right. I created pages and copied their URL and made them private which removed them from the main header menu (menu.php) they showed up in the left sidebar as wanted but clicking says page not found. So I made them all public so clicking on them (top nav only) worked but still, left side now does nothing, no page not found; except one that is using ?pageID but I am using date/name format so do not know where that came from (or is this a hint?). So then I added the exclude to the menu.php file like this:<?php wp_list_pages('exclude=birthday-party,djs,foam-parties,follow-us,hottie-of-night,join-our-text-list,pictures,throw-your-own-party,videos,vip-rental' ); ?> But the items are still on the top nav still and the links on the left don’t work. What is wrong?

Viewing 11 replies - 16 through 26 (of 26 total)
  • Thread Starter drumz

    (@drumz)

    Yes to your previous post, I did create it under Appearance/menus

    Thread Starter drumz

    (@drumz)

    Here’s my code for menu.php ` <?php wp_list_pages(‘depth=1&title_li=’); ?>
    <?php wp_list_pages(‘exclude=birthday-party,djs,foam-parties,follow-us,hottie-of-night,join-our-text-list,pictures,throw-your-own-party,videos,vip-rental’ ); ?>`
    And sidebar: `<?php wp_list_pages(‘include=birthday-party,djs,foam-parties,follow-us,hottie-of-night,join-our-text-list,pictures,throw-your-own-party,videos,vip-rental&title_li=<h2>’ . __(‘Pages’) . ‘</h2>’ ); ?>
    <?php endif; ?>
    `

    And you added it via the Custom Menus widget? Or did you inadvertently use the Pages Widget?

    You need to use something like:

    <?php wp_list_pages('depth=1&title_li=&exclude=1,3,5,7,9'); ?>

    where 1,3,5,7,9 are the ids of the pages you want to exclude.

    Thread Starter drumz

    (@drumz)

    Ok, I fixed that but this is driving me crazy! Here’s my code in menu.php but the exclude is being ignored:

    <div class="menu">
    
               <?php if(function_exists('wp_page_menu')) : ?>
                <?php wp_page_menu ('show_home=1&depth=1&title_li='); ?>
              <?php else : ?>
    
    	<ul>
                <li><a href="<?php echo get_settings('home'); ?>">Home</a></li>
                <?php wp_list_pages('depth=1&title_li=&exclude=birthday-party,djs,foam-parties,follow-us,hottie-of-night,join-our-text-list,pictures,throw-your-own-party,videos,vip-rental' ); ?>
            </ul>                
    
    <?php endif; ?>
    </div>

    Thread Starter drumz

    (@drumz)

    And you added it via the Custom Menus widget? Or did you inadvertently use the Pages Widget?

    I did do it in Appearance/Menus and I added it to the sidebar in the widgets area.
    If I could get it to exclude in the top menu then (I already made the file) I can hard code the left nav because that’s all they want there. Or maybe I should just hard code all of it…
    Or use a different theme but I already have a day in this one…

    The code above is saying “if the wp_page_menu exists, use it, otherwise use wp_list_pages”. The issue is that wp_page menu does exist. It’s been part of WP core since 2.7!

    So your menu uses wp_page_menu. The good news is that you can use exactly the same exclusion-by-page-id as you were trying to use with wp_list_pages.

    <?php wp_page_menu ('show_home=1&depth=1&title_li=&exclude=1,3,5,7,9'); ?>

    Thread Starter drumz

    (@drumz)

    Ok, Thanks, I think I’m getting closer…
    One thing though, do I HAVE TO use the page ID regardless of how I have permalinks setup? I would think it depended on the permalinks setting… Or was it just that wp-list-pages was being ignored because of wp_menu_pages? That might be a facetious question…

    do I HAVE TO use the page ID regardless of how I have permalinks setup?

    ‘fraid so. Is there any reason why page ids aren’t the best approach for you?

    was it just that wp-list-pages was being ignored because of wp_menu_pages?

    Bingo! My guess is that the theme hasn’t been updated since 2.7. At that time, the theme’s author was trying to use a fallback of wp_list_pages for all of the 2.6 users who wouldn’t have had access to wp_page_menu. If s/he hadn’t done this, any 2.6 user who activated the theme would have had their site collapse with an immediate fatal error.

    Since you’re using WP 3.0.1, you could cut that code block right down to:

    <div class="menu">
    <?php wp_page_menu ('show_home=1&depth=1&title_li=&exclude=1,3,5,7,9'); ?>
    </div>
    Thread Starter drumz

    (@drumz)

    That did it! I was using names for SEO purposes but will now usae a plug-in instead. So all along my replacing the name for the ID was that problem, I should have known better. FYI, just putting the code like you had it made nothing display so I had to put the else/if for wp_list_pages back in.

    I will have to hard the left sidebar though because of how it messes up the layout but that’s cool…

    Thanks so much for your patience!

    No problem ??

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Custom Menu links not working’ is closed to new replies.