How to convert yamm3 into wordpress - css

I am using bootstrap 3.2 in my wordpress project. I want to create a megamenu in bootstrap. I have found YAMM 3 has this functionality. But this is in HTML. Can any one tell me how can i integrate it in my wordpress project?

did you try use this nav walker?
https://github.com/macdonaldr93/yamm-nav-walker
so your code should look like this
<?php
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 4,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav yamm',
'fallback_cb' => 'Yamm_Nav_Walker_menu_fallback',
'walker' => new Yamm_Nav_Walker())
);
?>

Related

WordPress submenus with Understrap

I am working on a website that uses Understrap as a parent theme and a custom child theme. I having issues getting the navbar to show the 3rd depth of a submenu. Currently, it overlaps the previous layer.
I would like it to show up the right of the previous layer, or even dropdown and expand the original layer. How can I do this?
wp_nav_menu(
array(
'theme_location' => 'primary',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'navbarNavDropdown',
'menu_class' => 'navbar-nav',
'fallback_cb' => '',
'menu_id' => 'main-menu',
'depth' => 3,
'walker' => new Understrap_WP_Bootstrap_Navwalker(),
)
);

Removing WordPress Wrapper Div When container => false Fails

I'm having troubles removing the WordPress wrapper div from my wp_nav_menu(). I've passed container => false to my menu args but the div keeps displaying. I'm using the following arguments:
$defaults = array(
'container' => false,
'theme_location' => 'menu',
'menu_class' => 'main-nav',
);
wp_nav_menu( $defaults );
I have also declared the menu in my functions.php file.
register_nav_menus( array(
'main-nav' => __( 'Main Nav', 'ldsshop' ),
));
I have used these arguments with previous themes with no problems, but in this instance the wrapper keeps displaying, and I'm at a point where I need some extra eyes and help, no doubt I've missed something.
Thanking you all in advance,
Stu :)
Use container empty like this
'container' => '',
So it will like this
$defaults = array(
'container' => '',
'theme_location' => 'menu',
'menu_class' => 'main-nav',
);
wp_nav_menu( $defaults );
It will work, even it's working on my hand.
Update About Solved This Question
Try to the following using array in wp_nav_menu
wp_nav_menu( array(
'theme_location' => 'menu',
'container' => '',
'menu_class' => 'main-nav'
) );
use same '' about container if false not to work
Here is an article finding some helpful
See more in the codex https://developer.wordpress.org/reference/functions/wp_nav_menu/
In my case "container" => false doesn't work, It only works when you write "items_wrap" => "%3$s" but it removes all wraps including <ul> if you want to remove <div> and have your menu wrapped in <ul> I recommend to do this way
wp_nav_menu(array(
'theme_location' => 'header_menu',
'menu' => 'header_menu',
'items_wrap' => '<ul>%3$s</ul>',
'container' => false,
'menu_class' => 'nav',
'list_item_class' => 'nav-item',
'link_class' => 'nav-link',
'menu_id' => 'menu-main-menu'
));

Wordpress Primary menu not updating after reordering menu items

In functions.php, I registered primary menu like this-
<?php
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'intralink' ),
) );
?>
And in Homepage I have used below code:
<?php
wp_nav_menu( array(
'theme_location' => 'Primary',
'container' => 'ul',
'container_class' => 'navbar-collapse collapse',
'menu_class' => 'nav navbar-nav navbar-right'
));
?>
Then after creating a menu from wordpress Menus, nothing happens? Maybe it's not drag drop problem, maybe it's something I did wrong.
Thanks
Theme location should be 'menu-1'
It should look like the following
wp_nav_menu( array(
'theme_location' => 'menu-1',
'container' => 'ul',
'container_class' => 'navbar-collapse collapse',
'menu_class' => 'nav navbar-nav navbar-right'
));
Hope this will solve your issue.

current page style in wordpress with html 5 blank

anybody knows the blank theme html5 for wordpress? well i'm using this theme and i'm trying to add some style to the current page but i don't know how.
this is the function that the theme has:
function html5blank_nav()
{
wp_nav_menu(
array(
'theme_location' => 'header-menu',
'menu' => '',
'container' => 'div',
'container_class' => 'menu-{menu slug}-container',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul>%3$s</ul>',
'depth' => 0,
'walker' => ''
)
);
}
thank you very much!
See your question is not clear enough!! The above code is for styling the nav menus,
Here you can change the menu class, the container and lot more!!

Add sub text in the wordpress menu

I want to add text here within the anchor tag of the wordpress menu. So the menu structure would be
<ul>
<li><a href="#">Item1<br>
<span class="sub-text">text here<span></a>
</ul>
The "Item1" and "text here" will be dynamic. That is it can be edited from the wordpress back end.
I am using the wordpress function wp_nav_menu to show the menu. Below is the code.
$defaults = array(
'theme_location' => 'primary',
'menu' => '',
'container' => false,
'container_class' => '',
'container_id' => '',
'menu_class' => 'nav navbar-nav',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'depth' => -1,
'walker' => ''
);
wp_nav_menu( $defaults );
Please help.
You need a custom Walker to achieve that:
$walker = new Menu_With_Description;
wp_nav_menu( array(
'theme_location' => 'primary',
'walker' => $walker
) );
Tutorials all over the place on the web, e.g.: http://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/

Resources