0
votes
0answers
57 views

Add menu/submenu items programmatically

Newbie question here. I'm hoping to modify a menu programmatically and am having trouble figuring out the right way to do it. My site uses a membership plugin. Users pay to become members, and ...
0
votes
1answer
115 views

WordPress filter to hook into menu <li> items and add a custom attribute

I have a WordPress template (I'm using Foundation as a base and https://github.com/olefredrik/foundationpress/ as a starter theme) I'm trying to build and I can't seem to figure out how to hook into ...
1
vote
1answer
189 views

Run a filter when a walker runs

Is there any way to run a particular add_filter function whenever a specific Walker_Nav_Menu class runs? The function always needs to run when the walker goes, and I'd like them to share variables, in ...
0
votes
1answer
31 views

WP_NAV_MENU filter targets all menus

Im trying to replace my template's primary menu through a plugin so that I don't have to make changes to the header.php. I found this code in another question answered here in 2011 (Replacing ...
0
votes
0answers
25 views

wp_nav_menu: current_post_ancestor-category parent

I have a nav like this: page 1 -- page 1.1 -- category 1.2 page 2 page 3 When I am on a single post in the category 1.2, the category-menu-item gets the correct class current-post-ancestor and ...
1
vote
1answer
2k views

Add custom menu item using wp_nav_menu_items filter

I have added a snippet to add a "Profile" link to my website navigation menu. My code: add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link'); function my_nav_menu_profile_link($menu) { ...
1
vote
1answer
46 views

Is it possible to add a filter for the output of nav-menu items in admin?

I want to remove certain input fields on the admin screen for nav-menus for specific menu positions. I've used filters to filter front-end output but not for admin output. Is there a filter available ...
1
vote
1answer
136 views

Debugging - trying to add search box to menus

I have already asked a similar question at stackoverflow (http://stackoverflow.com/questions/22492292/add-filter-in-wordpress-how-do-i-know-if-it-is-run), but maybe that was the wrong place? As you ...
0
votes
1answer
29 views

search form leads to 404

I'm using the follow code in my functions.php to add a search box to my primary nav menu - add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2); function add_search_box_to_menu( ...
0
votes
1answer
47 views

How to conditionally add a wp_filter

I have a WP filter I created that I only want to run on certain menu items. I am attempting to use - function add_nav_class($output) { $output= preg_replace('/<a/', '<a class="lsbb"', ...
0
votes
1answer
164 views

How to add nav menu items to a specific position within a menu

I'm adding login/logout links to a nav menu using the following code: function rp_add_login_logout_links( $items, $args ) { $link = wp_loginout( get_permalink( get_option( ...
0
votes
1answer
22 views

Right way for setting categories

My site follows this hierarchy HTML5 + Themes Resources Books Tools Wordpress + Plugins Themes Tools Books jQuery + Plugins Tools books and the same combinations for CSS3, SEO and others, ...
2
votes
1answer
4k views

Add class to active element and its parent in nav menu

I am using the following code in order to add a class name "active" to the current menu item: add_filter('nav_menu_css_class', 'add_active_class', 10, 2 ); function add_active_class($classes, $item) ...
0
votes
1answer
57 views

Add Protocol to Custom Menus

I've been using tel: links in Custom Menus combined with Responsive Design to add a "Call Now" button to my themes for smartphones. It's been working well. A client just asked me to also add a "Send ...
3
votes
1answer
237 views

Determine which theme location a wp_get_nav_menu_items is for

Is there a way to determine which theme placement a menu is for when modifying it with the wp_get_nav_menu_items filter hook? I'd like to only add items to certain menus and I don't want to have to ...
1
vote
1answer
147 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 ...
0
votes
1answer
65 views

Function Reference for custom link in Admin Menu Management Page

What is the function reference for the text within the URL field in the Admin Menu page? I have a PHP function that is utilizing the_content function reference to look for specific file paths and ...
0
votes
1answer
239 views

Does the 'nav_menu_css_class' filter accept 2 or 3 arguments?

I've been using the nav_menu_css_class filter in one of my plugins, implemented as: add_filter( 'nav_menu_css_class', 'wbwcrf_nav_menu_css_class', 10, 3 ); function wbwcrf_nav_menu_css_class( ...
1
vote
1answer
182 views

list category posts under its item in menu

When adding category to Menu, I need it to list all the item that belong to that category in separate UL automatically. like this http://i.stack.imgur.com/ulOOS.jpg Of course I can do that manually, ...
0
votes
1answer
200 views

Prevent menu from loading in a page template [duplicate]

Possible Duplicate: Remove navigation from header in custom page template Is there some way to remove wp_nav_menu in a page template? I can't find anything related to page templates other ...
1
vote
1answer
241 views

display only the wp_nav_menu, which has the current-menu-item

i have a problem displaying only the menu with wp_nav_menu, in which the current-menu-item is in. Heres what i got: function register_menus() { register_nav_menus( array( 'sidebar-menu' ...
10
votes
2answers
2k views

How to add sub-menu to a menu generated by wp_nav_menu by using plugin

I have a menu generated by wp_nav_menu which look like <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" ...
0
votes
1answer
365 views

wp_nav_menu action/filter help

Maybe an odd question, I have a site that makes heavy use of nav menus. I'm looking to improve my site's performance, and since the menus hardly ever change, I wrote some PHP to spit them out into ...
0
votes
2answers
1k views

Insert a div before the wp_nav_menu

How do I go about inserting a custom div before the wp_nav_menu() adds the ul? The problem is that the script is inserting my 'div menu button' after the nav ul instead of before it. I am trying to ...
0
votes
1answer
165 views

add_filter for where statment issue

I am trying to get start and end dates for posts filtered, and I found the documentation for the 'posts_where' filter, I am just testing it so far, but when ever I add the filter, it seems to pull in ...
2
votes
1answer
971 views

Custom search filter causes menu and query_posts problems

I'm using a custom search filter (using my custom query var type), like so: function fteh_pre_get_posts( $query ){ if( isset( $query->query_vars['type'] ) ) $types = explode( ',', ...
3
votes
2answers
1k views

Unregister Nav Menu from Child-Theme

I like to use the Starkers Theme and build child-theme. So, I`d like to remove the this primary menu Starkers (functions.php) function starkers_setup() { // This theme uses wp_nav_menu() in one ...
0
votes
1answer
299 views

Edit html for menu items in default frontend menu

I am running Multisite, and would like to be able to append menu items to all frontend menus on all sites. This should work for menus saved via the admin interface as well as the default menu that is ...
1
vote
2answers
474 views

wp_list_pages() but only show children on the branch you are on

Lets say I have this menu: Top |___ Sub 1 |___ Sub Sub 1 |___ Sub Sub 2 |___ Sub Sub 3 |___ Sub Sub 4 |___ Sub 2 ...
3
votes
1answer
424 views

How to apply a class to the second word in menu list item?

I want to apply a class to a word in my menu. For example, say I have a list item in my menu called "My Item". I would like to apply a class to the word "Item" so that I can style it anyway I want. ...
0
votes
2answers
944 views

wp_list_categories() Exclude All Categories Except One

Is there a way to exclude all categories except one? I want to show a category and it's sub-categories as a dropdown menu, but the admin might add more subcategories to it so I don't want to limit ...
1
vote
4answers
2k views

When at / ( or “home”) my menu doesn't get a current-menu-item class

I'm a wordpress noob tweaking a theme, so I'm trying to understand how it works. I've read about 10 related posts in SE but don't get it yet. My problem is as follows: header.php seems to generate ...
0
votes
2answers
959 views

Removing strip_tags not working on nav_menu_description

So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp_nav_menu call in header.php to call the custom walker. ...
4
votes
2answers
6k views

Dynamically exclude menu items from wp_nav_menu

I tried looking for info about how to exclude/remove nav menu items from custom menus, and the only thread I found did not have any answers that were useful to me. 1. Background: I put together a ...
0
votes
2answers
872 views

Conditional custom menu?

I'm trying to create a custom menu that displays a <li></li> when a user is logged in, and not display it when they're not. I have this so far, but it's not working. Does anyone know how ...
1
vote
1answer
450 views

How do I access the menus produced by Dashboard > Appearance > Menus

A continuation to this question: Replacing WordPress menu functionality with a plugin Since I really rarely work with WordPress (I've done a lot of work with phpBB, myBB, Concrete5, and custom PHP ...
7
votes
1answer
573 views

Assign a Class to the Current “Tag” for Formatting

Essentially what I am hoping to replicate is something like the "current-menu-item" class that is applied to WP Menus. My client is wanting to use Tags as a sub-nav, and I've managed to get the tags ...
3
votes
2answers
1k views

Allow html tags in WordPress Custom Menus Description Field

I added descriptions to my menus using this post, Menu items description?. However I need to be able to use html tags and WordPress is stripping them out. Can anyone help?