Community Forums › Forums › Archived Forums › Design Tips and Tricks › Front Page Menu Only
- This topic has 5 replies, 2 voices, and was last updated 9 years, 6 months ago by
Brad Dalton.
-
AuthorPosts
-
July 15, 2015 at 8:26 pm #159518
sethbahookey
MemberAll,
How would I set up a conditional in Genesis to have a different front page menu compared to the rest of my site?
Thanks,
SethJuly 15, 2015 at 9:07 pm #159521Brad Dalton
Participant1. You can do this using a custom function with conditional tag
or
2. In your front-page.php file you can remove the primary nav menu and then add back another.
July 15, 2015 at 9:22 pm #159525sethbahookey
MemberThanks so much Brad! You always come out of left field with a great tutorial that you have created. 😀
July 19, 2015 at 9:13 am #159809sethbahookey
MemberBrad,
It doesn't look like I can target this menu because technically it is a widget in the Right Header widget section. I've spent quite some time on this today and I'm not much closer to a solution.
I only want a front page menu on the front page and then for the rest of the pages I'll have a standard menu.
Is there a simple tutorial to this? I haven't been able to find a guide for Genesis specifically on how to do this.
July 19, 2015 at 9:52 am #159814sethbahookey
MemberOk I think I have this figured out, but I don't think the styling is 100% still any suggestions would be greatly appreciated..
So first thing is first.. I had the menu in the right header widget area. I removed the menu from that and unregistered it first
//* Unregister the right header widget area unregister_sidebar( 'header-right' );
Then I had to create secondary menu area as Centric Pro doesn't have that as a default
//* Registering a new menu area add_action( 'init', 'register_additional_menu' ); function register_additional_menu() { register_nav_menu( 'secondary' ,__( 'Secondary Navigation Menu' )); }
Then I had to reposition the primary and secondary nav up into the right hand side of the header area
//* Remove the default hook locations and move into right header remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header', 'genesis_do_nav', 12 ); remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_header', 'genesis_do_subnav', 12 );
Finally I created a conditional for it to load based on whether it was a front page or standard page
//* Conditionally load menus add_action( 'genesis_header', 'front_page_load' ); function front_page_load() { if ( is_front_page() ) { add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'genesis' ) ) ); } else { add_theme_support( 'genesis-menus', array( 'secondary' => 'Secondary Navigation Menu', 'container_class' => 'genesis-nav-menu', 'genesis' ) ); } }
Then I had to do a whole bunch of style edits to the style sheet :/ It looks alright, but I still think there is a better way to do this.
July 19, 2015 at 9:05 pm #159847Brad Dalton
ParticipantExcellent effort!
There are always different ways to code the same solution.
Note: Your original question did not state you where using the header right widget therefore my answers where not targeting that element.
Here's my solution for members of WP Sites only http://wpsites.net/wordpress-tips/different-nav-menu-on-front-page/
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.