Articles of menus

Theme development: How to add CSS classes to menu items?

While building a custom theme, I’ve been stuck on how to add a CSS class to a certain theme menu (meaning a custom menu that is associated with a theme menu position). So far, in my template I have <?php if (has_nav_menu(‘main-menu’)) : ?> <nav class=”topmenu” role=”navigation”> <?php wp_nav_menu(array( ‘menu-class’ => ‘topmenu–list’, ‘theme_location’ => ‘main-menu’, […]

Un-highlight Blog Menu Item when Category Menu Item is Selected

On a site I’m working on, I am using a blog category called ‘Podcast’ for any podcasts that are posted. I have this as a menu item as pictured. My only issue is, that when I click podcast (just a link to /blog/category/podcast/ it highlights both the Blog and Podcast menu items (pictured above), which […]

Building Menu from Woocommerce Product Categories

I have created all of my Woocommerce product categories absolutely no problem there. Now I want to build my shop menu using the categories. The problem is, I have multiple categories with the same name but have different parents. As you can see from the image above I have no idea which categories “Carbon” or […]

Conditional menus based on page title

I’m looking to create and display a separate menu for a specific page. This menu needs to be in the primary location. So for example, on the Home page and the Contact page you would have: Home | About us | Contact. And on the “About us” page, you could show a different menu for […]

Need a menu on left sidebar of the page with below requirements

i have used below code to create Menu on left side of page. HTML: <div class=”left” id=”nav”> <ul> <li id=”light”> Video <ul> <li>Video 1</li> <li>Video 2</li> <li>Video 3</li> <li> Video 4</li> </ul> </li> <li id=”photo”> Photograms <ul> <li>Photograms 1</li> <li>Photograms 2</li> <li>Photograms 3</li> </ul> </li> <li id=”about”> About <ul> <li>About 1</li> <li>About 2</li> <li>About 3</li> […]

Add custom link on the fly to nav menu

I need to add custom links, on the fly, to the navigation menu. I can add custom links to the first level of items (created via Appearance > Menus), but for some reason, I cannot add a custom link, child of another custom link create previously.. Here’s my code: function on_the_fly($items) { $menu_items = array(); […]

display menu as table layout

I want the menu of this site to look like the menu of this site. It’s clear that they use display table and table cell but not sure how to implement it, been playing with css for a while, couldn’t nail it. Didn’t found a plugin that does the job but css should do. Do […]

Custom menu walker – remove li tag based on class name

I’m using wp_nav_menu() to display menu items with a custom walker. <ul> <li id=”menu-item-799″ class=”menu-item … custom-theme-class”><a href=”#”>custom content</a></li> <li><a href=””></a></li> <li><a href=””></a></li> … </ul> Now I’d like to change the li output depending on a class name. I use something like this: function theme_function($item_output, $item, $depth, $args){ $output = ”; // Overview Menu if […]

How can i create menu like in the example?

i try to create menu loop with structure like below, but i cant, default function wp_nav_menu doesn’t allow to do that, i don’t understand hot to do it. I need structure like in example with data-remodal-target count and data-remodaul-id. How can i do it? <nav class=”main-menu”> <ul class=”row between”> <li class=”main-menu__item”> <a class=”main-menu__link” href=”#” data-remodal-target=”modal00″>News</a> […]

WordPress post filter menu

Hi I am trying to create a form that filters my posts by 3 requirements, Categories, Author and Date. The user should be able to select a requirement from each dropdown (or leave empty for all) and get an outcoem based on that, so for example be able to select HMTL(from categories), Joe Bloggs(from Author) […]