wp_nav_menu custom walker class

You can try to alter the $attributes string, since that outputs the attributes in the a tag. The following is untested: $myClass=”some-custom-class”; $myClassAdded = false; $attributes=””; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( ‘href’ === $attr ) ? esc_url( $value ) : … Read more

Keep highlight on menu item with post pages

Yes! Found a solution which is working fine for my case 🙂 if(window.location.href.indexOf(“/blog/”) > -1) { $(‘#menu-item-339’).addClass(‘current-menu-item’); } if(window.location.href.indexOf(“/articles/”) > -1) { $(‘#menu-item-241’).addClass(‘current-menu-item’); } if(window.location.href.indexOf(“/forum/”) > -1) { $(‘#menu-item-437’).addClass(‘current-menu-item’); } Solution found here

Links in new menu don’t work

You have a script active that prevents normal behaviour of links if they have no target=”_blank” attribute on them. The original site has this attribute on the link to the blog, so that one works. The ‘new’ site doesn’t have it on the menu links, so those links are disabled. To fix this, go to … Read more

display content in multiple columns

found a simple solution ..I m posting full index.php <?php /** * Description: Default Index template to display loop of blog posts * * @package WordPress * @subpackage BootstrapWP */ get_header(); ?> <?php // Some sample styles for the images echo “<style type=”text/css”> .half { width: 50%; float: left; } .ng-row { clear: both; } … Read more

How to Add Class in

If you need to add different classes for the tag, consider using jQuery .addClass() for it or javascript solution if you don’t want to use jQuery. Your other options are to try and fit the parameters which wp_nav can use. $args (array) (Optional) Array of nav menu arguments. ‘menu’ (string) Desired menu. Accepts (matching in … Read more

Show navigation header menu by post and categery

This code will check to ensure that the theme_location is header. Also, menu is the parameter where the desired WordPress Nav menu is specified. menu_id is the HTML ID that is applied to the <ul> element which forms the menu. Docs on the arguments for wp_nav_menu() can be found here. add_filter( ‘wp_nav_menu_args’, ‘bb_wp_nav_menu_args’ ); function … Read more

Secondary Menu display Primary Menu

You’ve got the code close, but incorrect. It is a spelling issue. It should be: <?php wp_nav_menu(array(‘theme_location’=>’primary’)); ?> <?php wp_nav_menu(array(‘theme_location’=>’secondary’)); ?> Please note that in your array you are using the_location and not theme_location. I believe with your mistake the menu will default to the primary menu (though I haven’t confirmed this).