Walker_Nav_Menu Add Strings and Class Name

This drove me crazy. Here is the solution, hope someone find it useful or suggest a better and shorter solution: class sstmyp_Walker_Nav_Menu extends Walker_Nav_Menu { function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) { $id_field = $this->db_fields[‘id’]; // add custom class and carets to menu has children if(in_array(“menu-item-has-children”, $element->classes)) { $element->classes[] = ‘dropdown’; $element->title .= ‘ … Read more

How to remove anchor of current menu item in navbar?

Michelle is right. You could create your own walker and override the default method that creates the anchor. Or you can hack it by doing this: jQuery(document).ready(function($) { var current = $(“#nav_menu_id”).find(“.current-menu-item”); $(current).html( $(current).find(“a”).html() ); }); Where “nav_menu_id” is the id of your menu you wish to accomplish this on. Personally, I would invest the … Read more

Site-wide tabs at WordPress website?

Depends on where you want it, but the first thing that comes to mind is to simply add it in either header.php or footer.php in your theme. This is especially simple if the content won’t change often – just add the code to your theme files. If it’s content you want to change often, then … Read more

Installing wordpress on subdirectory 2 levels down

I managed to resolve this myself. Apologies for wasting anyones time. The fix was simple. I just had to add the following piece of code to my .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /jack/blog/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /jack/blog/index.php [L] </IfModule> Save my permalinks and the problem … Read more

Programmatically add a Navigation menu and menu items

I might be misunderstanding you, but why not use wp_create_nav_menu()? E.g., this is what I do to create a custom BuddyPress menu when I detect BP as active: $menuname = $lblg_themename . ‘ BuddyPress Menu’; $bpmenulocation = ‘lblgbpmenu’; // Does the menu exist already? $menu_exists = wp_get_nav_menu_object( $menuname ); // If it doesn’t exist, let’s … Read more