I'm currently using JointsWP for a WordPress theme. I'm running into an issue where the parent links in my dropdown menu are not clickable.
I searched the Foundation forums and found this thread that I thought would be helpful. It mentions adding data-options="mobile_show_parent_link: true" to the nav class top-bar.
JointsWP doesn't use the nav tag for it's menu, but I did add it where I thought it should be, which is the ul wrapper in the /assets/functions/menu.php file like so:
// The Top Menu
function joints_top_nav() {
wp_nav_menu(array(
'container' => false, // Remove nav container
'menu_class' => 'vertical medium-horizontal menu', // Adding custom nav class
'items_wrap' => '<ul id="%1$s" class="%2$s" data-options="mobile_show_parent_link: true" data-responsive-menu="accordion medium-dropdown">%3$s</ul>',
'theme_location' => 'main-nav', // Where it's located in the theme
'depth' => 5, // Limit the depth of the nav
'fallback_cb' => false, // Fallback function (see below)
'walker' => new Topbar_Menu_Walker()
));
} /* End Top Menu */
However, this is not working.
I've also tried:
data-options="is_hover: false"
Does anyone have any ideas on how to make the top parent link clickable when the submenu is expanded in mobile for JointsWP?
Thanks!
Related
My main wp_nav_menu is called header-menu
and that menu like this
Home
About
Insight
Test 1
Test 1
About 2
Test
Test
I want to call this menu in home page without showing sub items . That can i do using
<?php
wp_nav_menu( array(
'menu_class' => 'main-nav navbar-nav ml-auto',
'container' => false,
'theme_location' => 'header-menu',
'depth' => 1,
) );
?>
But after when i go to the Insight page i want to show secondary main menu and secondary menu (only test1 and test2) How can i do this
Create a new menu and conditionally call in home page , that would be easy solution
i Download and activate theme but i find that there is no way with setting to add links to footer menu because its support only one header menu
i download the Genesis Simple Menus from here https://wordpress.org/plugins/genesis-simple-menus/ and add this code in the functions.php file :-
// display the Footer Navigation
add_action('genesis_before_footer', 'wdm_add_footer_menu');
function wdm_add_footer_menu()
{
wp_nav_menu(array(
'sort_column' => 'menu_order',
'container_id' => 'footer' ,
'menu_class' => 'menu-tertiary',
'theme_location' => 'footer',
'depth' => 1,
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>'
) );
}
but nothing happened is that anyway to make this theme have footer location menu???
Add register_nav_menu('footer', 'Footer Menu'); in your functions.php
See this for details: https://codex.wordpress.org/Function_Reference/register_nav_menu
Follow the below link,hope it helps your cause,
http://premium.wpmudev.org/blog/add-menus-to-wordpress/
I have been trying to theme my navigation to use the twitter bootstrap. I want it to look like the demo example of a fixed top banner as seen here http://getbootstrap.com/examples/navbar-fixed-top/
I have got it working but I do not like the way I have got it working!
wp_nav_menu(
array(
'container_class' => 'main-nav navbar-collapse collapse',
'theme_location' => 'primary',
)
);
The code above builds my navigation, as you can see besides the default I have added navbar-collapse and collapse so it styles it according to bootstrap. This is not really the issue. The issue is when this piece of code then generates the menu I do not know how to add a class to the UL it creates so below is how I have done it.
$(document).ready(function(){
if($("#menu-menu-1").length !== 0){
$(".menu").addClass("nav navbar-nav");
} else {
alert("no navigation system");
}
});
This works by detecting the UL when the code has made it because it has an id of #menu-menu-1 then it adds the necessary classes and it all works.
Finally the question!
Is there a way to do this more efficiently because this method is very Quick Fix style and doesn't seem like a trustworthy permanent method. the alert was just there for testing purposes so I knew if the script was running
wp_nav_menu() has options for both menu_id and menu_class. To add both to your menu, you would do something like the following:
$menu_args = array(
'theme_location' => 'primary',
'container_class' => 'main-nav navbar-collapse collapse',
'menu_class' => 'nav navbar-nav',
'menu_id' => 'menu-menu-1'
);
wp_nav_menu( $menu_args );
I am trying to add a class to the default ul generated in a custom wordpress menu.
I have created the custom menu in the backend and set it up fine, after referencing the wordpress codex this is the code I am currently using:
<?php
if ( has_nav_menu( 'main-navigation' ) ) { /* if menu location 'main-navigation' exists then use custom menu */
wp_nav_menu(
array(
'theme_location' => 'Main Navigation',
'menu_class' => 'row',
'items_wrap' => '<ul class="nav">%3$s</ul>',
'walker' => '',
)
);
}
?>
This is generating a div with a class of "row" wrapping around my ul but no class is added to the ul itself. I have seen many people with this problem online but no solutions.
Thanks.
You can achieve this with jQuery by targetting the ul element and adding a class like this:
$(".row ul").addClass( "CLASS-HERE" );
Try this extension from GitHub. It allows you to use Bootstrap navigation components in WordPress with easy.
https://github.com/twittem/wp-bootstrap-navwalker
you can use parameter
'menu_class' => 'nav-menu'
I am trying to alter the wp_nav_menu to output the html like the below example.
<div class="menu">
<ul id="menu">
The original output
<div class="menu">
<ul>
I cant do it with jQuery or javascript, Its have to be php code
wp_nav_menu accepts the key menu_id in its options array. Set it to the ID you want, e.g:
wp_nav_menu(array(
'menu_id' => 'menu'
));
You can explicitly set the id in the html by defining items_wrap, and make sure walker is not set to some custom function:
wp_nav_menu( array(
'theme_location' => 'main-menu'
'items_wrap' => '<ul id="menu" class="%2$s">%3$s</ul>',
'walker' => '',
));
This is incomplete info; 1st attempt to use:
'fallback_cb' => false,
If you menu doesn't appear, that means you have not created any menu and that means its taking the fallback function take care for that.
So go and create a menu first. :D
Giving the ul an id that's the same as the class of its container is asking for trouble, but this should work:
<?php
function showMenu(){
$args = array(
'menu_id' => 'menu'
);
wp_nav_menu($args);
}
showMenu();
?>
The WordPress Codex has a page detailing all options for the wp_nav_menu() function: http://codex.wordpress.org/Function_Reference/wp_nav_menu