Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I just did a fresh install of WordPress to test my new theme. When I go to the site, the 2011 theme is active and the pages shown are "Home Sample Page" looking in the functions.php file, I would assume this code makes home show

 function savior_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
 }
 add_filter( 'wp_page_menu_args', 'savior_page_menu_args' );

When I activate my theme, only "Sample Page" Shows in the navigation even though I have the same code above in my theme. So I wasn't sure if this chunk of code above just takes care of adding home in the list for the menu or if it makes the home link appear in the default menu. I have been looking through the 2011 functions.php file trying to figure out how WordPress has home showing in the nav link by default without the primary menu set but I can't find it.

I have this in my header

 <?php $args = array('theme_location' => 'primary', 'container_class' => false, 'container' => '', 'menu_id' => 'navigation'); ?>
<?php wp_nav_menu( $args ); ?>

I know that when the primary menu isn't set, WordPress defaults to another menu. I don't remember exactly what it's called at this moment. But my pages are displaying. Can you shed some light on this?

share|improve this question
This will help you to clarify some concepts. – brasofilo Dec 5 '12 at 2:30
What code do you you to output/display the nav menu? – Chip Bennett Dec 5 '12 at 2:50
I added the code to my post above – Jamie Dec 5 '12 at 3:18
I figured out some of it. I am setting up a static homepage. I made a file called home.php which WordPress is picking up and using by default as my homepage. I found that if I add the is_front_page() to the wp_page_menu_args filter, then the home nav link shows. But it does not show when I switch to the sample page. So the conditional needs to match all cases. Not sure how to make that happen – Jamie Dec 5 '12 at 3:30
it's interesting to see that this question got closed for not being a real question or for being vague. If it wasn't a real question, how was I able to solve it? I know this solution will be helpful to others – Jamie Dec 6 '12 at 1:32

closed as not a real question by brasofilo, chrisguitarguy, toscho Dec 5 '12 at 8:43

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

okay, So I got it to work by doing this. Can you think of a better way?

 function savior_page_menu_args( $args ) {
    if ( is_front_page()) {
        $args['show_home'] = true; 
    } else {
        $args['show_home'] = true;
    }
    return $args;
 }
 add_filter( 'wp_page_menu_args', 'savior_page_menu_args' );
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.