Tag Info

Hot answers tagged

2

I think use Custom Walker. First register a custom navigation menu for this list in your theme’s functions.php class WP_Walker extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<div id='mega'><ul class='sub-menu'>\n"; } ...


1

Solution #1 (not ideal, but it works): // Live Chat Utility Link add_filter( 'wp_nav_menu_items', 'live_chat_utility_link', 10, 2 ); function live_chat_utility_link ( $items, $args ) { if ( $args->theme_location == 'utility' ) { $items .= '<li><a href="javascript:void(0);" onclick="olark(\'api.box.expand\')" class="livechat">Live ...


1

Good that it works. If it's for a client or if you just want cleaner code, you can do it as @Tom J Nowell suggested. Add a custom menu item, link it to nowhere or anywhere. Find out the menu item ID (every item has one), and then target that ID with jQuery. $("#menu-item-num").on("click", function(e){ e.preventDefault(); // olark code here ...


1

Here I have copied the Class used from the WordPress Core for you and then updated the Class name, Updated_WP_Nav_Menu_Widget that it is extending and used the widgets_init() action to register the widgit. /** * Navigation Menu widget class * * @since 3.0.0 */ class Updated_WP_Nav_Menu_Widget extends WP_Widget { function __construct() { ...


1

If I understand correctly, you want links with submenus to have an attribute of aria-haspopup. If this is correct, you should be able to do so using the nav_menu_link_attributes filter (WP 3.6 and above). You can also get around the necessity of having to write a custom Walker to check if an item has children by checking its css classes in the filter. ...


1

Have you tried adding the is_page() conditional like this: if( has_nav_menu( 'smone-menu', 'responsive' ) && is_page(array( 10,11 ))) {


1

You can achieve this using the wp_nav_menu_items hook. Let's have a look at the following piece of code which shows the login/logout link on the primary menu location. add_filter( 'wp_nav_menu_items', 'wti_loginout_menu_link', 10, 2 ); function wti_loginout_menu_link( $items, $args ) { if ($args->theme_location == 'primary') { if ...


1

Its quite odd to have two themes running like you describe, but I think we can figure this out. In both themes, wherever your menu is printed (probably header.php) you'll need some code like this that chooses the correct menu, then prints it: $desktop_theme_name = 'Desktop Theme Name'; // Replace this with the name of the desktop theme $mobile_theme_name = ...


1

I do think that the days of creating a separate theme for mobile users are long gone. With proper planning and layout you can use one theme on desktops, laptops, tablets and mobile devices I would tackle this is a much different way. Firstly, I would create my theme in such a way it is responsive on according to the required screensize like normal. For ...



Only top voted, non community-wiki answers of a minimum length are eligible