Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I tried with this code:

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


but gives me this error: Error 404 - Not Found

I would like that when I click on "Home Page" menu appears the recent posts.
And I would like to place an icon instead of "Home Page" writing.
Thank you!

share|improve this question
    
How are you calling the menu in your template? In terms of the icon you can do that using CSS so it's not strictly WordPress related. You can get answers to that on stackoverflow.com –  sanchothefat Nov 3 '11 at 14:08
    
@sanchothefat I called the menu in Appearance → Menus. –  humanbeing Nov 3 '11 at 14:10
    
Do you have a set static page set as your home page? –  Nicole Nov 3 '11 at 14:19
1  
"but gives me this error: Error 404 - Not Found" - this is a non-sequitur from the first part of your question. What action, specifically, gives you a Error 404 - Not Found. –  Chip Bennett Nov 3 '11 at 14:28
    
I solved, thank you for help! –  humanbeing Nov 3 '11 at 14:40
add comment

1 Answer 1

up vote 2 down vote accepted

To add a home link to menus that you create via the menus admin area:

  1. go to the Pages box,
  2. click the 'View All' tab
  3. 'Home' will appear, check the box and click 'add to menu'

enter image description here

share|improve this answer
    
I was going to suggest this. Adding $args['show_home'] = true; to page_menu_args does two things: 1) Displays a "Home" link in the default wp_page_menu() fallback for wp_nav_menu(), and 2) adds a "Home" page option to the Pages meta box in Dashboard -> Appearance -> Menus, thereby allowing the user to add the "Home" page link to a custom menu. –  Chip Bennett Nov 3 '11 at 14:30
    
Thank you @sanchothefat! –  humanbeing Nov 3 '11 at 14:39
    
@ChipBennett the 'Home' checkbox is always there in the view all tab regardless of any other settings in the theme. I've all always found it there without setting $args['show_home']. Have you observed a different behaviour in WP or have I misunderstood you? –  sanchothefat Nov 3 '11 at 18:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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