Tag Menu items based on their categories
From the WP-Admin. Click on Appearance > Menus In the top right, click “Screen Options” Select (check) “CSS Classes” Then you will have added the optional “CSS CLASSES” to each menu item.
From the WP-Admin. Click on Appearance > Menus In the top right, click “Screen Options” Select (check) “CSS Classes” Then you will have added the optional “CSS CLASSES” to each menu item.
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
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
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
how to display notifications in the wordpress menu when a new post is published
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
Adding button to wordpress menu
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
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
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).