Community Forums › Forums › Archived Forums › Design Tips and Tricks › Moving logo into main navigation (magazine pro theme)
Tagged: Magazine Pro, nav menu
- This topic has 10 replies, 3 voices, and was last updated 7 years, 4 months ago by Brad Dalton.
-
AuthorPosts
-
November 7, 2016 at 2:29 pm #195848Saqib AliMember
As the title suggests I'd like to move the logo into .nav-primary http://britishhomeopathic.co.uk/
I'd also like to move the search bar into the .nav-primary area.
And now there's a blank space I'd like to get rid of this also if possible.
How would I go about doing this?
I'm assuming php right?
http://britishhomeopathic.co.ukNovember 7, 2016 at 6:57 pm #195874ᴅᴀᴠɪᴅMemberYes php.
But what you'd be better doing is moving the primary nav into the header, in between the header and the search. Then making the whole header sticky.
There is documentation on how to move the primary nav;
http://my.studiopress.com/snippets/navigation-menus/#reposition-primary but you'd need to use the hook genesis_header instead of genesis_before_header as they use in the example.Then make the whole header sticky, there are numerous tutorials about that show how to do this. here's one https://ozzyrodriguez.com/tutorials/fixed-header-wordpress/
I love helping creative entrepreneurs build epic things with WP & Genesis.
November 7, 2016 at 7:30 pm #195876Brad DaltonParticipantNovember 15, 2016 at 4:12 pm #196209Saqib AliMemberThanks guys I was able to get it working with the snippets.
I'm still trying to add the logo to the top left but for some reason, it's not working, I must be not using the hook correctly.
November 16, 2016 at 12:57 pm #196255Saqib AliMemberAnd also the slider now is getting eaten up by the nav-primary.
November 30, 2016 at 9:57 am #196824Saqib AliMemberWas I supposed to do this?
//* Reposition the primary navigation menu remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header', 'genesis_do_nav' );
November 30, 2016 at 10:18 am #196826Brad DaltonParticipantTo add your logo to the nav menu, please use the code i linked to above.
November 30, 2016 at 4:44 pm #196837Saqib AliMemberThanks, appreciate you highlighting the same link @braddalton.
I tried the first approach but I was going around in circles.
I've copied and pasted the code from the link into my functions.php file but I only see options for being to add:
- Changing primary to secondary / vice versa
- Search
- Time and DateHow would I go about adding the logo into the top left or as the first item?
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 ); /** * Filter menu items, appending either a search form or today's date. * * @param string $menu HTML string of list items. * @param stdClass $args Menu arguments. * * @return string Amended HTML string of list items. */ function theme_menu_extras( $menu, $args ) { //* Change 'primary' to 'secondary' to add extras to the secondary navigation menu if ( 'primary' !== $args->theme_location ) return $menu; //* Uncomment this block to add a search form to the navigation menu /* ob_start(); get_search_form(); $search = ob_get_clean(); $menu .= '<li class="right search">' . $search . '</li>'; */ //* Uncomment this block to add the date to the navigation menu /* $menu .= '<li class="right date">' . date_i18n( get_option( 'date_format' ) ) . '</li>'; */ return $menu; }
December 1, 2016 at 6:53 am #196849Brad DaltonParticipantCreate a variable equal to your image
$image = 'http://example.com/image';
Then swap out the code for the date with the variable for your $image.
December 2, 2016 at 3:25 am #196901Saqib AliMemberCheers @braddalton really appreciate the help and good job with the video.
December 2, 2016 at 4:47 am #196908Brad DaltonParticipantYou could also use esc_url( $url ) to sanitize your URL like this:
$image = esc_url('http://example.com');
Or
Pull the image from your child theme's images folder using get_stylesheet_directory_uri()
$image = sprintf( '%s/images/logo.jpg', get_stylesheet_directory_uri() );
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.