0

My home page is a dynamic page and on my navbar I have different static pages I want to add one to link to the homepage as if I clicked the logo.

2 Answers 2

1

To add a link to the homepage in your navbar, you can use the following function to add a link to the home page in wp_page_menu_args

function wpse01_home_link( $args ) {
   if ( 'main-menu' === $args -> theme_location){
       if (! isset( $args['show_home'] ) )
          $args['show_home'] = _x( 'Home', 'homepage' );
   }
   return $args;
}

add_filter( 'wp_page_menu_args', 'wpse01_home_link' );

You can just rename Home to suite your needs

9
  • It works just fine but it adds the link on a separated menu what ruins the navbar
    – yes_in
    Commented Jun 9, 2014 at 8:23
  • Check update, add condition to only add home to primary menu Commented Jun 9, 2014 at 8:32
  • Have you solved your problem? Commented Jun 9, 2014 at 10:24
  • No, not really! sorry what do you mean by check update ? update the page under the pages menu or what ?
    – yes_in
    Commented Jun 9, 2014 at 11:04
  • I have updated/changed the code in my answer, that is what I meant :) see if that helps Commented Jun 9, 2014 at 11:10
1

You can add "Custom" links to WordPress menus. There, just enter the URL to your website with the title you want.

Custom links

2
  • even though I had to redesign the CSS it worked
    – yes_in
    Commented Jun 9, 2014 at 11:02
  • That's good to hear. If the answer works for you, please mark it as "Accepted".
    – engelen
    Commented Jun 9, 2014 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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