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.
950
questions with no upvoted or accepted answers
7
votes
1
answer
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
2
answers
655
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
0
answers
1k
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.
...
3
votes
1
answer
569
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
1
answer
771
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
1
answer
2k
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
1
answer
597
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
1
answer
1k
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
0
answers
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
0
answers
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
1
answer
1k
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
1
answer
756
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
1
answer
770
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
0
answers
1k
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
0
answers
670
views
Add acf custom fields so sub item in menus
Please, can anybody help me, I've been struggling so long with this
Basically, I want to add custom fields to sub menu items, I want to add an image and a link. I can see fields showing up in sub ...
2
votes
0
answers
446
views
You do not have permission to create Navigation Menus - Twenty Twenty-Two theme
I have a WP Multisite, where I am the super-admin of the Network and the only admin (also super-admin) of this particular site.
Everything is working fine, but whenever I try to edit/add Navigation ...
2
votes
0
answers
202
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
0
answers
416
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
0
answers
584
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
0
answers
39
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
0
answers
300
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
0
answers
403
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
0
answers
295
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
1
answer
1k
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
0
answers
1k
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
0
answers
21
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
0
answers
482
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
3
answers
42
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
0
answers
263
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
1
answer
1k
views
Add code to WordPress menu items by class
I am trying to add
onclick="toggle_visibility('sub-menu');"
into the opening tag of specific menu items generated in WordPress. I have used the following function to target all parent menu items ...
2
votes
1
answer
1k
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
0
answers
533
views
Create menu / submenu from category subcategory and posts
I have a custom menu made up of pages and categories and I am trying to output the category and subcategories as well as the last 4 posts from each category/ subcategory.
In trying to use a walker ...
2
votes
0
answers
1k
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
1
answer
2k
views
Programmatically set current-menu-item using wp_nav_menu
I'm calling wp_nav_menu programmatically on a class and I'd like to be able to set the field that will be shown as the current-menu-item but I don't see an argument for that.
It seems like I may be ...
2
votes
1
answer
2k
views
Multiple navigation menus to a location?
I want to be able to assign multiple menu's to 1 navigation location.
But when I want to assign the second navigation, the previous is unassigned.
How would it be possible without breaking the ...
2
votes
0
answers
1k
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
1
answer
1k
views
Adding an admin menu page showing the link twice - how to solve this?
I'm newbie and I'm trying to create a plugin to add a menu to left menu in admin section.
i have create the page but it is working fine. but i find the left menu being displayed twice. how can I ...
2
votes
1
answer
356
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
0
answers
16
views
Custom loop menu is not working
I am using the below code to create a custom WordPress menu for mobile. With this code, nothing is return. Even the menu is not retrieving. Can anyone assist me with this? This is a multilingual ...
1
vote
0
answers
8
views
Wordpress menu disappears in category pages
I have a custom query to order and display posts in my functions.php, and I noticed that the navigation menu disappear in those categories!
function my_filtro_ed_ordine( $query ) {
if ( ...
1
vote
0
answers
33
views
Is there any documentation on JS trigger for the Gutenberg "Navigation" block?
I'm trying to programmatically trigger the close function on the Navigation block (I'm using swup and want to have the nav close when a new page dynamically loads). I see that it's using the ...
1
vote
1
answer
176
views
Can't add custom post type archive page to menu
I cannot add this custom post type archive page to any menu from the admin. Adding via the front end customizer works fine. Viewing the archive page on the front end also works fine.
My custom post ...
1
vote
1
answer
44
views
Submenu items not working anymore
Not sure where I am going wrong here... Submenu items in my website have stopped working across entire site with custom links/anchor tags.
Examples:
https://bell.works/new-jersey/on-the-block/
(Sub ...
1
vote
0
answers
84
views
How do I get the menu items based on name or ID?
I have this code that gets menu items, currently it works using slug-id (main-menu)
$menu_name = 'main-menu';
if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
...
1
vote
1
answer
49
views
Displaying list of random links using wp_nav_menu
Is it possible to modify wp_nav_menu to display a list of random links? I tried adding 'orderby' => 'rand', but that didn't do anything. I'm afraid my PHP skills are rudimentary, at best.
The rest ...
1
vote
0
answers
575
views
How to change how WordPress renders navigation menu on Block Themes
With classic templates it was easy to understand how to overwrite how Wordpress navigation menu was rendered, but I'm struggling with the new Theme blocks approach.
I know it uses the navigation block ...
1
vote
0
answers
211
views
burger on mobile
it's a week that I'm stucked with the burger menu on mobile/small screen. When I click on the burger nothing happens even if everything seems good with the code. Where am I wrong?
Here the HTML / PHP
...
1
vote
0
answers
46
views
Walker class conditional based on parent menu item label or custom css class
I'm out of my shallow depth here. I'm trying to add html to the end of drop down menus whose parent item is either a specific item label or custom css class that's been added via the WP menu admin.
...
1
vote
0
answers
511
views
New menu is not showing in api response
I just make a custom Menu because I wanted to add a link in my menu but for some reason the new menus are not showing in the API response. any idea why and how should I fix this?
I add a new menu ...
1
vote
0
answers
36
views
How to approach this menu design?
I was given this design, and I'm struggling to find a way to implement something like this.
The 6 items on the top bar dropdown on hover, then each has a submenu in the orange box to the left. ...