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.

Filter by
Sorted by
Tagged with
1 vote
2 answers
745 views

How to add bubble count in WordPress wp_nav_menu menu?

I have to add a bubble notification in WordPress wp_nav_menu like the following code. <ul> <li> Tickets <span class="unread">2</span></li> <...
Kvvaradha's user avatar
  • 936
0 votes
1 answer
1k views

Add data-id attribute to child page links

The should be simple but I just can't figure it out nor find an answer. I need to add a data-id attribute to the <li> parent container of the respective child page <a> links. The HTML is ...
DaveyJake's user avatar
  • 143
1 vote
1 answer
320 views

Add a class to the body tag when a menu is enabled

Question edited How can I add a class to the body when the menu at the menu setting > theme locations is selected. Like in this screenshot: And if I have two menus, can it add two different ...
jquery's user avatar
  • 11
1 vote
1 answer
2k views

How to replace the page url for the page slug in a menu link?

I am developing a single page site within WordPress, that contains multiple sections. These sections are pages in WordPress. In my index.php I loop through all pages within WordPress and add them to ...
Casper's user avatar
  • 379
24 votes
8 answers
46k views

Get WP Navigation Menu from REST API V2

I'm trying to get the navigation menu from JSON response using WP REST API v2 plugin. There is no navigation menu plugin extension for the REST API v2, but only for V1. From codex WordPress Post ...
Murhaf Sousli's user avatar
2 votes
1 answer
322 views

Make menu structure match page heirarchy on page parent change

Old WordPress themes like twentyten contained functionality which allowed nav menu structure to reflect changes in page heirarchy. For example, if I have the arbitrary page heirarchy (and matching ...
James Cushing's user avatar
1 vote
1 answer
6k views

Adding Custom "Current Menu Item" class to navigation?

I'm using the following code to force my wordpress navigation to reflect the category of the current post. It works perfectly, but I need help to extend this function to more than just 1 category ...
speedypancake's user avatar
0 votes
1 answer
948 views

How to exclude pages in the menu without pageID?

I am creating a single page site, that contains multiple sections. These sections are pages within WordPress. I use the following loop to get all pages in index.php file. <?php $args = ...
Casper's user avatar
  • 379
1 vote
2 answers
1k views

Two different menus for two different locations?

I'm trying to change the menu in a primary and a secondary menu depending on the page which is visited. My primary menu is in the top of the page, and it looks like this: Index | About | Contact ...
Mane Sandoval's user avatar
1 vote
1 answer
4k views

Counting top level items in a custom menu walker

I am creating a split menu (half the items on the left, logo in the middle, remaining items on the right). I don't really understand Walkers all that well, but I found this code snippet. This was ...
clancimus's user avatar
1 vote
1 answer
83 views

Get latest posts from WordPress site without header, menu and sidebar

I have no knowledge about WordPress. However, I want to fetch and display the latest posts of a WordPress site in an application window. One way to do so is to use the RSS feed. However, this ...
Horst Walter's user avatar
2 votes
1 answer
170 views

Creating new menu item

I'm looking for a way to create a new item that can be added to a menu. Here are the details of my problem: I use WPML. WPML have that nice feature that you can add the switcher to a menu, ...
Fredy31's user avatar
  • 858
0 votes
1 answer
30 views

Mark a page of a queried menu as active

Im trying to mark as active a page of a queried menu --> (I found the answer) function render_main_menu(){ $args = array( 'post_type' => 'a_cpt', 'tax_query' => array( array(...
Oniromancer's user avatar
14 votes
3 answers
2k views

Is there an easy way to replace a custom menu link with a page or post?

I've looked for plugins and couldn't find anything and I believe this should be a core feature. The Problem: The current methodology for replacing a custom link, or any menu link is by doing the ...
Aziz's user avatar
  • 235
0 votes
1 answer
195 views

How to add a toggle on the left side of my page?

How to add a toggle on the left side of my page and the content on the right side of my wordpress page. The toggle should behave like a menu on the left side(the arrangement)and each heading would ...
Saranya Ravi's user avatar
4 votes
2 answers
5k views

Check if a menu is empty?

I have menus set corresponding to a custom field on a page. Ie I have menu1, menu2, and menu3 on three pages under custom field => MenuName. Under functions.php I have: /* Add Menu Locations */ ...
o_O's user avatar
  • 279
0 votes
1 answer
1k views

Custom nav menu current item custom link problem

Because I want to add <span class="dashicons [class]"></span> inside each link of my menu I needed to create a custom made nav menu. I did this by the code below which works great, but ...
Robbert's user avatar
  • 1,245
1 vote
1 answer
472 views

is_page() not working with archives?

I am creating a dynamic menu and in my foreach loop I am running a is_page using the page title: <li class="<?= (is_page($tlp->post_title) ? 'active' : '');?>"> </li> This works ...
Lovelock's user avatar
  • 111
0 votes
1 answer
1k views

Adding archive years to my menu

I'm Wordpress newbie and despite of reading many articles, I'm able to put archive years to my main menu. Menu contains pages and I need to add an archive. My current menu: - Home (page) - About (...
Roman's user avatar
  • 15
1 vote
1 answer
292 views

Replace menu permalink/hyperlink with only menu name/slug

I don't know if i am asking this correctly, but i will try. I am doing this for history pushstate purpose. Code to get menu wihout ul and li: $topmenu= array( 'container' => false, '...
Tauras's user avatar
  • 123
0 votes
1 answer
1k views

Menu not appearing in custom theme

I made a custom theme, but the menu is not showing in appearance section. I created a separate function file named function.php and the code is: add_theme_support( 'menus' ); function ...
Sajjad Khan's user avatar
0 votes
2 answers
90 views

wp_nav_menu doesn't work in a duplicate server

I duplicated my Wordpress installation to move to another server. Everything works find except one single file. I created a header-shop.php file to call a certain menu on my shop page. In the first ...
Tasos's user avatar
  • 169
0 votes
1 answer
180 views

how to change single post link

I have made a website for a client which involves products tab in navigation. Products are the posts that being posted in "posts". I have a front-page.php which is static. posts are displayed in ...
Gautam-Toraskar's user avatar
0 votes
0 answers
215 views

Add parent link to its submenu

How to add parent link to its sub menu in navigation bar? I mean any hook, filter or custom navigation Walking? You may know, this problem is coined from the feature of mobile menu, I cannot go to ...
Trang's user avatar
  • 351
0 votes
1 answer
100 views

Any simple way to show 10 previous pages by id to current page in links as a menu

I've been reviewing any plugin that may help in this but I got nothing. For a web using pages instead of posts, I may need to show in each page a menu consisting of 20 previous pages, or maybe 10 ...
Zacocom Zaccom's user avatar
0 votes
1 answer
217 views

Parsing Menu Items and Blog Posts

Question 1 I'd like to be able to show or hide certain pages in the main navigation menu based on whether or not they have certain prefixes in their title. This is mostly for the purpose of language ...
Usman Mutawakil's user avatar
6 votes
4 answers
6k views

Remove current_page_parent nav class from blog index when in CPT

I'm trying to remove current_page_parent class from the blog index menu item (I got a custom page to display all blog posts and it is in the menu) when navigating custom post type archive page and ...
Kevin Mamaqi's user avatar
2 votes
2 answers
1k views

how to only add a top-level admin menu without it creating a sub-level-menu

Here is a the code snippet: add_action( 'admin_menu', 'travel_site' ); function travel_site(){ add_menu_page( 'Travel Site Menu', 'Travel Site', 'manage_options', 'travel-site-menu', '...
dave's user avatar
  • 133
0 votes
2 answers
1k views

How to Add support for sub-menu item description in wordpress?

I am working on a Custom Nav Walker and I want to use Description field in wordpress menu in my theme. The field works fine as far as for First Level Menu items but when I add something in sub-menu ...
bakar's user avatar
  • 101
0 votes
1 answer
146 views

Is it possible to separate all submenu items?

I'm using FoundationPress as a starter theme and I'm trying to separate the submenu. My theme basically generates menus like this: <ul> <li class=" first-level has-dropdown"> &...
Lepus's user avatar
  • 101
0 votes
2 answers
4k views

Use wp_logout_url() in menu creation page

can anyone give me some idea about how I can use the value of wp_logout_url() within the menu creator page of wordpress? As the menu creation page doesn't support php I cannot just put echo ...
iSaumya's user avatar
  • 934
0 votes
1 answer
112 views

Can't change link for navigation item

I'm customzing a wordpress theme so problem is that i've to change a link. its in arabic for example instead of this <a href='somelink.com'> i want to make it like this but problem is that ...
Sikander's user avatar
  • 101
0 votes
1 answer
52 views

Site-wide tabs at WordPress website?

Is there a solution to add tabs at the whole site (site-wide) and not just in posts and pages? For example: I need one "tabs group" consisted of 3 tabs, and I like to add it sitewide (the same ...
DeeJay's user avatar
  • 1
6 votes
1 answer
16k views

How do I add a search box to the nav menu?

I would like to add a search box to the nav menu by appending the following code in functions.php (at the end of the file, but before ?>). add_filter( 'wp_nav_menu_items','add_search_box', 10, 2 );...
SparkAndShine's user avatar
0 votes
1 answer
46 views

Wordpress functions.php does not affect the theme menus

I am trying to customize my pre bought theme. What i try is, to have different menus for each page without using a plugin. Original theme has a function about navigation which uses walker class. here ...
ytsejam's user avatar
  • 115
0 votes
1 answer
1k views

How to add buddypress sub-menu items to other menus

I want to use BPs sub menu items in other menus. By default you get following items to drop them in menus; Activity Notifications Profile Logout I want to add "Profile -> Edit" to the list. In ...
ezkay's user avatar
  • 25
0 votes
1 answer
42 views

Frontside menu based on custom roles logged in permission

I have two phases to my site, the first is menu, i want my site to hide (normal) menu items if the user isn't logged in e.g when someone visit my site, the menu should be Home About us Products ...
localhost's user avatar
  • 484
2 votes
1 answer
413 views

Custom Walker anchor tag not inheriting attributes

So I am just now learning and playing with custom walkers and I came across this really helpful Stack Overflow question. So I implemented the answer in that answer and added this to my functions.php ...
salad_bar_breath's user avatar
0 votes
1 answer
647 views

How to make menu output links absolute

The page and post links added to WordPress menus are relative in nature. I need a way to force them to be absolute without using the "Custom Link" option. Is there some function or maybe a modifier ...
Shannon's user avatar
0 votes
1 answer
8k views

Custom nav walker with different output depending on depth

I am trying to redevelop a HTML site as a Wordpress theme, and the HTML menu is as follows: <ul> <li class="current"><a href="#"><div>Home</div></a></li> ...
Adrian's user avatar
  • 344
4 votes
1 answer
705 views

How to call "page specific menu items" in template [closed]

I have installed a plugin for giving custom command for menu to display on each Page Specific Menu Items, now I need to display these menus on theme header. Can I use anything like wp_nav_menu(). ...
binita dutt's user avatar
0 votes
1 answer
165 views

Vertical Menu items shifting to same line when window size increased [closed]

I've tried messing with float and clear but could get anything to keep this from happening: "Fun" and "Shop" are supposed to be on different lines. Here's the CSS involved with the nav/ul/li/a: nav ...
4514's user avatar
  • 13
1 vote
3 answers
3k views

Making menu link open in new tab?

I'm trying to add a top level menu to the left sidebar of the WordPress admin panel. Here's the code I currently have: add_action( 'admin_menu', 'linked_url' ); function linked_url() { add_menu_page(...
John's user avatar
  • 11
1 vote
1 answer
790 views

Change submenu markup

I've seen people recommending to edit the wordpress default Walker to change the menu markup and create your own. The problem with this is that I would like to change the markup of the submenu and ...
Alvaro's user avatar
  • 131
0 votes
1 answer
980 views

Current author archive in navigation menu

I want logged-in user see her/his own author archive page link in top navigation menu,say (a link to a list of all her/his posts). What I achieved so far is this: function my_nav_menu_author_link( $...
Wordpress Speed's user avatar
1 vote
1 answer
298 views

How to add programmatically all pages and children to backend menu

I have a big website with tons of content, and I would like to automatically add all pages and their children to the menu in the backend, so I can then rearrange them easily via drag and drop. I ...
Kalianey's user avatar
  • 175
0 votes
1 answer
30 views

URL links consistent with menus?

I'd like to have a URL links consistent with menus on the page. For example: Menu1: Submenu1 item1 item2 Submenu2 item3 item4 Menu2: Submenu... etc.. The corresponding links shoud be: ...
Danijel's user avatar
  • 153
2 votes
1 answer
5k views

Mark menu item as current-menu-item for category

I have some categories on my WP website. When users sees this categories and posts from them i want to mark one of menu items as active. How can i set one of my menu items to have class "current-menu-...
moonvader's user avatar
  • 322
0 votes
1 answer
27 views

Custom location for menu

Does anyone know why when I the code to implement the menu it displays the menu right after the body tag. And this is where I add my code <div class='nav'> <a href='#' class='menu_btn'&...
user68181's user avatar
0 votes
2 answers
188 views

How do I display entries in the top menu based on conditions selected in the sidebar menu?

Hi. I don't know ajax programming. I know HTML, CSS, little bit of php(so much that I am editing and customizing all the default themes, and learning along the way). I have attached the UI of the ...
A Kashyap's user avatar

1
27 28
29
30 31
65