Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Website Setup › Menus › Change menu layout in header
- This topic has 1 reply, 2 voices, and was last updated 5 years, 8 months ago by Themosaurus.
-
AuthorPosts
-
@themosaurus
- 1 Topics
- 1675 Posts
Hi Jon,
The main menu is displayed by the
gwangi_grimlock_navbar_nav_menu
function located in inc/grimlock/grimlock-template-functions.php in your Gwangi theme. However I would advise against modifying the code directly in Gwangi as all your custom changes will be deleted when you update Gwangi.Here is a code snippet I built that you can use as a base to hopefully help you achieve your goal:
if ( ! function_exists( 'gwangi_grimlock_navbar_nav_menu' ) ) : /** * Prints the wp nav menu inside Grimlock Navbar. * * @param array $args The array of arguments for the navigation menu. */ function gwangi_grimlock_navbar_nav_menu( $args ) { if ( is_user_logged_in() ) : ?> <ul class="nav navbar-nav navbar-nav--search"> <li class="menu-item"> <div class="navbar-search"> <?php get_search_form(); ?> </div><!-- .navbar-search --> </li> </ul> <?php else : if ( has_nav_menu( 'primary' ) ) : wp_nav_menu( wp_parse_args( $args, array( 'theme_location' => 'primary', ) ) ); endif; endif; } endif;
To add this code snippet to your website without directly modifying Gwangi files, you can either use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) or create a child theme and add the snippet to the functions.php file of that child theme (if you are not already using one of our child themes).
If you need more information about adding custom PHP to your website, I invite you to read these articles of our documentation:
Please keep us updated if it helped you achieve your goal.
Best regards,
August 2, 2018 at 13:24 #1531 -
AuthorPosts
The topic ‘Change menu layout in header’ is closed to new replies.