Tagged: x
-
AuthorPosts
-
September 28, 2016 at 4:14 pm #1194644
Hi there,
I would like to set my blog page (news) to have a custom menu. I am using menu swapper throughout the site, however, it does not work on the blog page.
Could you please advise on how I can accomplish this?
Please see site details in response below.
September 28, 2016 at 4:15 pm #1194649This reply has been marked as private.September 28, 2016 at 8:16 pm #1194952Hello There,
Thanks for writing in! What you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
After the child theme is set up, please add the following code in your child theme’s functions.php file
// Custom menu in Blog index // ============================================================================= add_filter( 'wp_nav_menu_args', 'custom_blog_menu' ); function custom_blog_menu( $args ) { if ( is_home() ) { $args['theme_location'] = 'primary'; $args['menu'] = 'Blog Menu'; } return $args; } // =============================================================================
The code will swap the menu for the blog index. Just make sure that you have supplied the correct name for the
'Blog Menu'
. I think you will need to create another menu in Appearance > Menu.Please let us know if this works out for you.
September 29, 2016 at 9:55 am #1195819I created a new menu and used the Code Snippets plugin to input the code; it worked like a charm… Thanks for the help
September 29, 2016 at 11:05 am #1195937Glad to hear it,
Joao
-
AuthorPosts