Articles of menus

Customise the custom menu widget

Is it possible to customise the custom menu widget? All I really want to do is change the text where it says “select a category”. Thanks

WordPress Login/Logout Single Menu Only

I’ve written this login/logout for my functions.php in my wordpress theme. The problem is, it’s showing a login/logout link in all menus both primary and secondary. Is there a way to get it to appear only in secondary? add_filter(‘wp_nav_menu_items’, ‘add_login_logout_link’, 10, 2); function add_login_logout_link($items, $args) { ob_start(); wp_loginout(‘index.php’); $loginoutlink = ob_get_contents(); ob_end_clean(); $items .= ‘<li>’. […]

Show menu only if_page is

I have created 4 menus (submenus) in wordpress. I need to know how show this menus only if pages ids are “10 and 11 for example. Is possible? I’m desperated after two hours… thanks! This is my code for one of them: <?php if( has_nav_menu( ‘smone-menu’, ‘responsive’ ) ) { ?> <?php wp_nav_menu( array( ‘container’ […]

2 wordpress site same database

I have twoo websites on worpdress platform: http://fian.ro/ http://nuovafattoria.ro/ On the server there are 2 different folders with same files, same config but one of them has: define(‘WP_HOME’, ‘http://nuovafattoria.ro/’); define(‘WP_SITEURL’, ‘http://nuovafattoria.ro/’); so is the same database but different url. I wanna made some changes on one of them, different logo, background so I need a […]

How to programmatically add elements in a custom menu

In my WP custom menu, one item has a dropdown list below it that lists all instances of some CPT. The only way I know to do that is by creating the list somewhere else in the DOM with PHP and then moving that list right inside the custom menu item with Javascript. Problem: this […]

Pagination doesn't work on multiple categories

I have the following problem. In my custom menu (wp_nav_menu) I added a category. This category uses the template category.php. Now I have multiple categories that are shown on the page. My problem is that the pagination doesn’t work. It shows the link en all but page/2/ display’s an ‘page not found’-page. I have no […]

Hook on creating a menu entry?

I need to run some code after a new item has been inserted into a WordPress nav menu. Is there any hook on menu modification or something similar?

Add menu headings to WordPress sub menus

I’m using the native WordPress menu. I have two top-level links with sub menus – I’d like for those sub menus to display the name of the parent menu item. So if I have a parent menu item named “Gardens” containing a sub menu of “Flowers” and “Plants”, that sub menu should say “Gardens” at […]

How to Emulate Default Navigation Menu Behaviour in a Custom Theme?

I’m trying my hand at developing a custom theme, and I’ve got navigation menus working (with the help of this walker, but only if they’re explicitly defined in the menu settings. The default themes (twentyfourteen, twentythirteen) seem to be able to create a default menu solely from the existing pages hierarchy, without needing to create […]

How can I add a class to a nav menu when I'm viewing a child page?

I’m using bootstrap in my theme, so I have a requirement that I add a class of active to the current nav menu item. I was able to achieve this by using the nav_menu_css_class filter add_filter(‘nav_menu_css_class’ , ‘special_nav_class’ , 10 , 2); function special_nav_class($classes, $item){ if( in_array(‘current-menu-item’, $classes) ){ $classes[] = ‘active ‘; } return […]