Help needed creating a custom Hamburger menu in header

I see 2 things. 1 (your point 5). $(‘#toggle’).toggle( // don’t you need a click action here? And i think you’re using toggle() the wrong way. Example: $( “#toggle” ).click(function() { $( “#toggle” ).toggle( “slow”, function() { // The matched elements will be revealed or hidden // Animation complete. }); }); 2. <div id=”toggle”> <img … Read more

How to change navwalker’s dropdown mark-up?

STEP 1 add a script to header like below ( it’s always better go for the enqueue method . i need some one to help me with properly adding the below script in WordPress way .jquery should run before the second script> <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js” type=”text/javascript”></script> <script> $(document).ready(function () { $(‘.dropdown-menu a.dropdown-toggle’).on(‘click’, function(e) { if (!$(this).next().hasClass(‘show’)) … Read more

Add active class to wp_nav_menu

You wont need that PHP code to style links to the current page in your nav. WordPress adds a class (current-menu-item) by default on links to the current page. But WordPress does not style the link for you. That would be part of the theme. You can add a rule to the theme’s CSS ( … Read more

Menu with category 2 category combined

Please explain the logics of 2 menus displayed on same page. I believe you menu structure is as follows: first dishes – fish – chicken second dishes – fish – chicken So your main categories are ones like “first dishes” and “second dishes” How do you want to show main categories – as separate menus? … Read more

WordPress customizing a walker menu class

If you want change only CSS classes, you can use filters nav_menu_submenu_css_class (for <ul> element, codex) and nav_menu_css_class (for <li>, codex). Example of usage: add_filter(‘nav_menu_css_class’ , ‘special_menu_item_class’ , 20 , 4); function special_menu_item_class($classes, $item, $args, $depth) { // add or replace classes $classes[] = ‘rd-nav-item’; if ($args->has_children) { $classes[] = ‘rd-navbar–has-dropdown’; } return $classes; }

Add class to specific li item menu in function.php

To add CSS classes to menu item li, use filter nav_menu_css_class (codex). add_filter(‘nav_menu_css_class’ , ‘hideMenuItem’ , 15 , 4); function hideMenuItem($classes, $item, $args, $depth) { $commerce = get_field(‘ecommerce’, ‘option’); if ( !$commerce ) { $menu_items = array(566, 567, 363, 364 ); if ( in_array($item->ID, $menu_items) ) { $classes[] = ‘hidden’; } } else { $menu_items … Read more

How to make certain posts not appear on the main page, but instead only a newly created category(in the menu section)

You can exclude posts in the “Reviews” category from the main feed using the pre_get_posts hook and some WP_Query knowledge: add_action( ‘pre_get_posts’, function ( $wp_query ) { if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_home() ) { $wp_query->set( ‘category__not_in’, 4 ); } }); Here I’ve assumed the ID of the category is 4, you’ll need … Read more