Questions tagged [menus]

Navigation Menu is a theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for introducing customised navigation menus into a theme. In order to incorporate menu support into your theme, you need to add a few code segments to your theme files.

928 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
2k views

Registering menu with 'Automatically add new top-level pages to this menu' selected

Is it possible to register a menu inside of a theme functions file and have 'Automatically add new top-level pages to this menu' pre-selected? I can't find any info about this in the ...
6
votes
1answer
589 views

Link to Author archive from Navigation Menus in dashboard?

I'd like to display a grid of authors on my site showing the name of the author and their avatar. The tricky part is, I'd like to be able to control this from the Menus page in the dashboard so I have ...
3
votes
1answer
508 views

Replacing the NavWalker dropdown element

I'm creating a website for my school with Material Design for Bootstrap and the NavWalker is giving me some issues, I want to change the element of dropdown i.e. from ul to div. I've tried to edit the ...
3
votes
1answer
529 views

Add Menu items description via Custom Walker for wp_nav_menu()?

Here is a solution I've found, and it works to append a description after the link. My question is: Is it also possible to append a description before the link? function add_description_to_menu($...
3
votes
1answer
1k views

Add div to specific sub-menu

I researched in google, yandex but had no success. With this code I can set a div to sub-menu but this code add to all sub-menus, I just need to add div to specific sub-menu. class Megratron_div ...
3
votes
1answer
498 views

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I'm looking to generate a tabbed submenu from taxonomy term or submenu item and include sample content (three items per term/submenuu item). The styling I can do, the problem is the html generation. ...
3
votes
1answer
913 views

Automatically Add New Tags to Sub-menu

Been searching for any related plugins or info. about this case but didn't find anything relevant or working. I need every new tag that is added to a post automatically appear in a menu as a sub-menu ...
3
votes
0answers
1k views

Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar

I have 8 custom post types (which are actually for 8 different blogs and used as "blog landing pages"). Each custom post type is also a Blog Category and each has several sub categories to it. For ...
3
votes
0answers
1k views

How to add ID and class in nav menu walker?

I would like to set up a custom walker that produces the following output: <div id="navbarHolder"> <div id="navbar"> <ul> <li><a id="nav_about" ...
3
votes
1answer
819 views

Wrap description and sub menu in a wrapper

I am trying to add a wrapper to description and sub-menu in wordpress using walker class, Description will only be shown for the first menu so the structure will look like this EDIT I have been ...
3
votes
1answer
622 views

Set Item Order with wp_nav_menu_{$menu->slug}_items

I have some code that adds a menu item to a menu using wp_nav_menu_{$menu->slug}_items. It's pretty easy to add a menu item as the first or last item of the menu, but I was wondering if there's ...
3
votes
1answer
715 views

How do I approach removing menu items on the fly based on settings in my plugin?

I've started writing a plugin that allows the administrator to select specific pages and set them to be visible only to logged-in users; the plugin optionally applies the restriction to all child ...
3
votes
0answers
925 views

wp_nav_menu custom walker - child items

I have written a custom walker to integrate a jQuery drop-down nav script into my WordPress template. I need to add .dropdown-link to each of my parent menu items and .dropdown-wrapper to the ...
2
votes
0answers
68 views

Header Button Chance Polylang Elementor

Currently, I am making a Bilingual website, and I made a button on the header as well, and I want to make the button bilingual as well, but I don't know how could I change its language because it is ...
2
votes
0answers
214 views

How to extend nav-menu-item-control data in Appearance > Customize?

I have one question as for Nav Menu Items custom fields in the Appearance > Customizer screen. Since 5.4. there are 2 new hooks: wp_nav_menu_item_custom_fields - it works for Appearance > Menus ...
2
votes
0answers
267 views

Hide Login information in Account settings in Buddy Boss

First time working with Buddy Boss. I managed to customize the navigation items on the profile page, but I can't find a solution for the Account settings page. What I'm trying to achieve is to hide/...
2
votes
0answers
35 views

Use walker for specific menu, or avoid use of walker

I'm trying to solve a particular problem and having trouble figuring out which way is best. So, I have a menu (generated through WP's menu creator) and would like to pull the featured image of each ...
2
votes
0answers
904 views

Add Product categories to Wordpress menu without losing hierarchy

I need to add product categories to Wordpress menu, but when I'm doing this with WP interface it lose the hierarchy I tried with WP-CLI, but there is no method to specify wich item is the child. ...
2
votes
0answers
179 views

Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I'm not

Working on a custom api for a site I'm building and I found a weird issue with wp_get_nav_menu_items. Essentially - wp_get_nav_menu_items only works and returns items when I'm logged in. If I'm not ...
2
votes
0answers
231 views

Custom Category/Subcategory structure

I am building a site with several sections, and one of them is a special page to navigate through categories in a hierarchical style (you can navigate into categories/subcategories and see their ...
2
votes
0answers
338 views

wp_get_nav_menu_items return results are insane

I was hoping to create a plugin that adds a new post to a Menu on the second sub-items. However I can't ever seems to get the orders correctly it some times work and sometimes doesn't. Last thing I've ...
2
votes
0answers
224 views

Import menu tree to custom menu from csv or xml, many nested menu points

what would you recommend to import about 6000 menu items (yes it is ab big catalog with many nested categroies, depth about 6) to a custom menu in Wordpress. I have a text file with the following ...
2
votes
1answer
942 views

Create Dropdown menu Using wp_nav_menu() function

Kindly provide me wp_nav_menu structure to create the following dropdown menu. <div class="container"> <div class="nav-menu"> <a class="toggleMenu" href="#">Menu</a> <ul ...
2
votes
0answers
906 views

Update Nav Menu Items Programmatically

I know this may sound stupid, but I created a code which (in theory) should add a few submenus to my primary menu. However I don't seem to be able to display this new menu because I don't know when I ...
2
votes
0answers
15 views

Change where navigation bar links?

I have a client with a WordPress blog who wants to have her website run two separate websites in the same WordPress installation by duplicating pages and changing the place that the navigation bar ...
2
votes
0answers
261 views

Programmatically create menu with custom link

I am creating pages and assign them to a menu with custom link. Pages are properly created and menu is properly created, too. However, custom links are not given to the menu items. What I want is to ...
2
votes
3answers
37 views

Remove Page Name From Wordpress Menu

I have a Wordpress menu that are both being used as a normal menu with page name that links to the page. I want to echo the same registered menu, but without the page name. To be clear, I still want ...
2
votes
0answers
169 views

Wordpress menu that shows all posts in a certain category like w3schools

I am working on creating a widget menu(kind of a sidebar like w3schools) that is supposed to show all posts that are listed in a particular category. And update automatically from particular category(...
2
votes
1answer
859 views

HTML in Menu Items disappear on save

I've created a menu that, instead of plain text, needs to have icons. Unfortunately the "CSS Classes" option provided by WP adds the class to the li rather than the a so the icon won't be clickable if ...
2
votes
1answer
671 views

How to display dynamic content in start_lvl function

I am creating a custom nav walker but having trouble outputting parent menu item title in start_lvl function. I want to output it right after the <div class="dropdown"> in the following ...
2
votes
0answers
976 views

Custom Loop through category menu to include sub categories

In my custom wordpress theme I currently have the below loop to the main categories <?php $menu = wp_get_nav_menu_object('navigation'); $items = wp_get_nav_menu_items($menu->term_id); foreach($...
2
votes
0answers
961 views

Getting post content within wp_nav_walker

I have a custom walker set up designed to add content into the nav menu. The problem being that it is not pulling the content. The post object returned by the get_post/get_page has an empty ...
2
votes
1answer
246 views

selected menu item

The template I'm working on for a client has the following pages: Home : a custom static page that displays the content of a certain WP page, and the latest sticky posts. This is the front-page.php ...
1
vote
0answers
13 views

Second Set of Eyes: One custom taxonomy shows in Appearance > Menus, one does not

I presume this is a scenario where I've overlooked something in syntax, or a basic setting. But I've looked it over so many times I need fresh eyes. I have the following code which adds a Product CPT, ...
1
vote
0answers
16 views

Displaying primary nav menu two ways

Trying to modify the Twenty Twenty-One main menu. Given a main nav menu such as: Name of organization (links to home page) About Etc... For default behavior (on most pages other than home page), we ...
1
vote
0answers
21 views

Multisite: menus can't be added in child sites

It seems that we cannot add menus in child sites in multisite. Did anyone face this issue before? I have the Menu container enabled in my functions.php register_nav_menus( array( 'primary-...
1
vote
0answers
22 views

how to make accessible menu with WordPress for those people with disabilities?

i want to develop a wordpress navigation with default wp_nav_menu() but i am succeeded yet. i tried a lot of example and tips but its not match the requirement, sometimes i got solution in such its ...
1
vote
1answer
38 views

How to add ID attribute to each submenu?

I would like to add an ID attribute to each list <ul> submenu. I am using the Walker class extension. I have managed to modify some elements, but I am left to solve this one problem. I need the ...
1
vote
0answers
26 views

Easiest way to add dropdown to a page

I am trying to add a dropdown menu to my page (not menu or widget section) and once the user selects an item from that menu, it redirects to a specific page. I have tried using the block editor, but ...
1
vote
0answers
15 views

Wordpress warning: “private_to_published” Deprecated when creating nav with wp_update_nav_menu_item()

For reasons specific to how my local development environment generates Wordpress menu items, I am trying to programmatically create a menu using wp_create_nav_menu() and wp_update_nav_menu_item(). My ...
1
vote
0answers
20 views

Add css class to dropdown

This is a dropdown with two items. I want to visually give these two items a css style. Is this possible? This is the code I used: (function($) { "use strict"; tinymce....
1
vote
0answers
23 views

Automatically adding new post categories to menu

Disclaimer: I am not 100% fluent in php. If I am doing something wrong in asking this here, please let me know. Many thanks! A site that I am working on is set up with several custom post types: City, ...
1
vote
0answers
27 views

Change search results order for Admin -> Appearance -> Menus -> Pages -> View all

I have over 200+ pages (about 100 for each of my two languages). How I can change the order of results? I need the same as on the page with Page list. On the Page list e.g. you have a parent page and ...
1
vote
0answers
16 views

nav_menu not displaying custom menu

Default menus will appear on all pages with no issues. However, when I configure a custom menu, it is displayed on all pages, other than the home page//main blog page. The menu disappears, the tags ...
1
vote
0answers
50 views

Add data attribute to each li in menu

I have a menu listing all of my products categories in Woocommerce. I need to add an attribute data-relation to each <li> tag and the value for each one would be the ID of the category. I ...
1
vote
1answer
24 views

display menus on all page except one?

I'm not very good at this, so please bear with me. I have a Wordpress site with sections for different cites, and the different cities each have their own nav menu which shows for all of the pages in ...
1
vote
1answer
7 views

How do you link to a place in another page without any styling issues?

I have a 'Meet Our Team' section on my home page and I want to be able to click a menu button 'Meet Our Team' and be directed there, even if I click it from another page. My problem is that if I use #...
1
vote
0answers
18 views

How to create left and right menu with logo center in a custom theme?

I recently developed a new custom theme in wordpress. I want the following menu structure: Left menu LOGO Right menu For example: Home About LOGO HERE Blog Contact I created the following code: <...
1
vote
0answers
16 views

How to get the element ID from new menu list that added with add_filter()?

I wanna ask how to get the element ID (with javascript) from new menu list that added with add_filter() ? So i'm trying to make a plugin that insert new menu list with add filter like this : ...
1
vote
0answers
18 views

WordPress Menu Prepends URL To My Anchors

I have a menu created in the WordPress menus page. It is made up of anchors created using custom links. For instance, I have a custom URL #claims which is supposed to anchor drop down to the "...

1
2 3 4 5
19