All Questions
Tagged with menus customization
174 questions
1
vote
3
answers
6k
views
How to add html attributes to the "ul" html tag with "wp_nav_menu" function?
I'm trying to improve my learning WordPress is very new, and the first theme.
My problem is,
With the function "wp_nav_menu" into the "ul" tag,
data-hover = "dropdown" data-animations = "zoomIn ...
1
vote
2
answers
1k
views
Remove a menu sub-item
I want to remove a menu sub-item. But i cant'find the right item to delete. It is a plug caled "New User Approve". And the slug is :/wp-admin/users.php?page=new-user-approve-admin
I don't want to ...
0
votes
1
answer
505
views
How do I create a root link in wordpress to a PDF file?
I want to upload my resume to media (which I have done) but link it directly to
joeblow.com/resume
I want that link to display the PDF ideally or if not possible to redirect to a URL (the resume is ...
0
votes
1
answer
1k
views
Adding images to anchors in the list created and fetched with wp_nav_menu
I have created a custom menu which is usable from the wp-admin. I call it using wp_nav_menu and the menu is created in an ul as text-only links.
I wonder if there is a way to change these text-links ...
0
votes
0
answers
1k
views
WordPress menu walker - Get parent item text inside end_lvl function
I have a parent menu item which is taxonomy name. I want to add in a mega menu with a featured post from the menu taxonomy in the left of the sub menu.
This code works and shows displays the html ...
1
vote
1
answer
477
views
Position a hard-coded menu item
I used a piece of code I found here in wordpress.stackexchange to add a custom link to my menu/nav. I adapted to my needs and it works great. The problem is it adds the link in the first position in ...
0
votes
1
answer
66
views
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-...
0
votes
0
answers
91
views
HTML TO WP Theme : Submenu goes down wp_nav_menu
I have to convert a html to wp but there is an issue sub menu is not working properly.I am newbie but I have done something for that still not success.
header.php Code
<nav class="navbar ...
1
vote
1
answer
1k
views
How can I get the page url slug when 'post_name' returns an id?
I have the following code:
$menu = get_term( $locations[$theme_location], 'nav_menu' );
$menu_items = wp_get_nav_menu_items($menu->term_id);
foreach( $menu_items as $menu_item ) {
$link = $...
0
votes
1
answer
396
views
how to hard link to the posts page?
I am setting up Wordpress site for a client with very limited options for her to edit. As a part of this customized and very limited setup, I have created front-page.php and I am hard-coding the ...
0
votes
1
answer
43
views
Wordpress custom dropdown listings
I have a site with a database of repair shops, by;
Manufacturer - Venue
I want 2 dropdown lists at the home page.
In the first dropdown, when i select the "Apple" the second list appears in the ...
0
votes
2
answers
1k
views
Add a data attribute to list item element in menu
Looking to add a data attribute to a list item in a menu, I can see that some threads on here can add it to the actual <a> link tag, I am looking to add it to the list item itself <li>
So ...
1
vote
2
answers
235
views
Putting <a> tag outside <li> tag on generated Menu
I'm trying to make a social links menu for the footer in my theme. I want a menu to be customisable in Dashboard, I want the links to be relative to what's put in there.
Originally to get that, I did ...
0
votes
1
answer
310
views
Child Theme header1.php file not overwriting parent theme's header1.php file
I am trying to add a custom header navigation to a WordPress site using a child theme (I'm using the Alphabet theme). I determined that I am using the header1.php file according to the styling inside ...
0
votes
2
answers
2k
views
How to request container_class from wp_nav_menu
I'm currently trying to setup a custom nav walker that will use container_class from the menu as a prefix for the class names of the list items and children.
$defaults = array(
'menu' =>...
2
votes
1
answer
945
views
Only append custom classes to nav menu items
I was reviewing this extremely helpful post on cleaning up WP-generated classes and ids from the nav menu, and found RevelationTravis's option-- see code below-- to be particularly good as a way to ...
6
votes
3
answers
3k
views
On which hook should I be calling register_nav_menu(s)?
I've variously seen register_nav_menus() called:
on after_setup_theme
on init
pasted "loose" into functions.php
with no apparent change in functionality.
Which hook should I be using to call this ...
0
votes
1
answer
10k
views
How to undo the last changes to a custom menu?
I have a wordpress site with a custom menu. When I want to add a page or something to the menu, I click appearance, add the item, then drag it to the right location. This time when I did it the menu ...
1
vote
0
answers
127
views
Sub menu indicator that links to sub menu
I am trying to create a custom mobile menu for my wordpress site. I have looked around the net for an answer and found similar things or different ways that I can accomplish this but not in the way ...
1
vote
1
answer
30
views
Blog Posts in Custom Menu
I have a custom menu but would like to put specific posts on each one.
for example: my menu consists of: cooking, beauty and style. How can i put all cooking posts on the cooking tab, and all beauty ...
5
votes
2
answers
6k
views
Add custom html to last sub-menu item
I'm adding a custom menu to my wordpress theme. I need to add custom html to the final submenu item - before the primary sub-menu closes </ul>
I have registered my new menu
//functions.php
...
1
vote
0
answers
121
views
Navigation label for page in custom theme
In Appearance -> Menus, one can change a page´s navigation label. The label is what shows in the menus. However, i´m using a theme with a custom menu, always showing the full page´s title in the menu. ...
1
vote
0
answers
427
views
Custom Navigation build using wp_nav_menu and walker
What I have
Right now I have an old template in plain HTML. In there I use a custom Navigation menu built like this:
<div class="collapse navbar-collapse main-menu main-menu-1" id="main-menu">
...
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 ...
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 ...
0
votes
2
answers
190
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 ...
0
votes
1
answer
850
views
How can i display custom menu in sidebar?
I would like to display a custom menu in a custom sidebar instead of author information or blank space i.e custom menu with similar styles as default menu but only in vertical manner as displayed in ...
0
votes
1
answer
757
views
Buddypress: New Tab and Page (Members Profile) [closed]
I want to add some pages/tabs to the user's buddypress profile.
I'm using the following function to get at least one page working:
function my_bp_nav_adder() {
global $bp;
...
-1
votes
1
answer
2k
views
removing extra mobile menu from the header
I have installed burger theme and modified some template files to my needs. when I came to header, I decided to go with a simple bootstrap navigation bar, that doesn't require an extra menu. I took an ...
0
votes
1
answer
335
views
How to have multiple Wordpress Menus
If possible, could someone answer this in very easy steps as I am new to coding.
I was wandering if there is an easy method for having multiple menus in any theme; I have been searching the internet ...
1
vote
1
answer
163
views
Programmatically (PHP) get the nr. of items in the primary navigation menu
I need to get the nr. of items in the primary navigation menu. I need this to determine the width in percentage of each list item. So I also need to change/add to the css width attribute of the list ...
-1
votes
1
answer
3k
views
How to move menu next to left of the search box?
I use Woocommerce plugin and StoreFront theme to build my demo website at http://52.74.97.64/wordpress/
I want to move the current menu to another place - on the left next to the search box on the ...
0
votes
0
answers
33
views
How to work around the bug which prevents custom menus from being deleted?
A bug makes it impossible to delete a custom menu in the expected way: select menu, click Delete Menu. This has never worked for me on any WP site in any version of WP; it produces an Error 403 and ...
0
votes
0
answers
991
views
Class .current-menu-item in custom menu Walker
I'm building a blog using a custom walker for my submenu which looks like this:
class Submenu_Walker extends Walker_Nav_Menu {
function start_el ( &$output, $item, $depth = 0, $args = array(),...
0
votes
3
answers
813
views
Theme for subcategories
I am working with categories (cities) and subcategories with the same menu (for example: cars, animals, houses).
Therefore right now my categories structure looks like this:
- London
-- cars
-- ...
2
votes
2
answers
7k
views
Add static item to wp_nav_menu
I am trying to add static menu item to Wordpress Menu.I am using filter 'wp_nav_menu_items' for this in functions.php. It works but it doesn't put it under menu container tag.
function ...
0
votes
4
answers
14k
views
How to add active state to the navigation links?
I am trying to add active states for my custom menu navigation, but so far everything I try
is just not working. I have set the navigation menu in a separate file nav.php,
then I included the nav.php ...
1
vote
1
answer
7k
views
How to add wechat (weixin) link to navigation menu?
The profile link of WeChat (or Weixin) has the following format: weixin://contacts/profile/username
As you can see, it doesn't use http:// and that seems to be the reason that it cannot be added to ...
3
votes
1
answer
464
views
Walker class: Problems with understanding how walk() method can be called without error
I am struggling with understanding how WordPress uses the Walker class. In particular, I don't understand the walk() method (I think).
First, let me explain what I understood:
When calling ...
0
votes
0
answers
91
views
how to display wordpress navbar with top menu outside wordpress system
i want to display my wordpress top navbar outside of wordpress system in one of my php site, so that whenever i change the wordpress navbar the changes will reflect on my php site.
How to do that?
I ...
0
votes
1
answer
404
views
Get custom classes in Wordpress Navigation Menu
i'm a beginner to Wordpress. I have a question is how to get only classes we put in CSS classes box in Navigation Menu? Not all with the default Wordpress classes. The purpose of this is i want to ...
1
vote
1
answer
2k
views
Custom Admin Menu Order
I have a simple solution in my functions.php for reordering the admin menu. Here it is:
// Admin menu - reorder
function custom_menu_order($menu_ord){
if (!$menu_ord) return true;
return array(
...
0
votes
2
answers
183
views
Wordpress Menu Exchange On Tablet's Orientation
I am using the plugin PHP Browser Detection and I want to achieve different menus for different devices. I have set them up called primary and mobile.
Now, I want to switch those on used device. ...
0
votes
1
answer
501
views
Wordpress Menu Exchange for Mobile Layout
I want to have two different menus for desktop and mobile phone users.
So, I have created two places for two menus (primary, mobile) with this function:
functions.php:
function is_register_my_menus(...
3
votes
1
answer
47k
views
Menu is not visible in appearance
I have added following code to my function.php
function register_my_menu() {
register_nav_menu('header-menu',__( 'Menu' ));
}
add_action( 'init', 'register_my_menu' );
And here is my code where ...
1
vote
1
answer
273
views
How to add custom classes to more than one separate menu's a link in wordpress?
Here is a link to my website: website
I have placed the following code to this document in /wp-includes/nav-menu-template.php
Towards the end of the code are several lines that start with $...
0
votes
3
answers
8k
views
Filter to hook into menu <li> items and add a custom attribute
I'm using Foundation as a base and starter theme. I'm trying to build and I can't seem to figure out how to hook into the menu that WordPress outputs and add a custom attribute to that menu's <li&...
2
votes
2
answers
2k
views
Change HTML structure for custom menu in sidebar
I've been digging for documentation on how to change HTML output for the "Custom menu" which you place in optional widget. So its clear what I meen I have attached an image of the widget block here:
...
0
votes
1
answer
1k
views
Extend walker - navigation, adding data attribute to a tag
I would a data attribute to the a tag in the menu, like have <a href="#example" data-attribute="attribute">CLICK</a>
I know that I have to extend the Walker BUT I tried in several times ...
0
votes
1
answer
2k
views
I can't add more pages to menu - menu delete pages
Two days ago I decided to add three more pages to the menu on my site. I already had like 140 pages in the menu, so this is something I know how to do. But I hadn't done it in some months, so maybe ...