How do I add nested categories to drop-down menu in twenty-eleven?

As a purely theory example, this is how I would approach the problem: $cats = get_categories(); echo ‘<ul>’; foreach($cats as $cat) { echo'<li>’.$cat->name; if($cat->parent != 0) { $subcats = get_category(‘child_of=”.$cat->cat_ID; echo “<ul>’; foreach($subcats as $subcat){ echo ‘<li>’.$subcat->name.'</li>’; } } echo ‘</li>’; } echo ‘</ul>’; I don’t expect that to work fully as I coded it … Read more

Using wp_get_nav_menu_items() to list children of children pages

Well, I’m afraid I never did work out the code to this. What I did find is a pair of plugins that accomplish what I’m looking to do. List sub pages of the same level as the current sub page/child/grandchild page and then be able to exclude certain pages from showing up. http://wordpress.org/extend/plugins/child-page-navigation/ http://wordpress.org/extend/plugins/exclude-pages/ Might … Read more

Call custom field into menu item

This is what i have used for checking to see if the custom field is there or not. I am sure you can use it as well. <?php $custom_field = get_post_meta($post->ID, ‘Your Custom Field Name’, true); // Checks to see if there is a value in the custom field if($custom_field != ”) { echo $custom_field; … Read more

How can I add (custom) modules to Appearance -> Menus?

When you register a custom post type, set the argument show_in_nav_menus to TRUE, and WordPress will create the box for you automatically. This works for custom taxonomies too. Example, requires PHP 5.4 or newer. add_action( ‘wp_loaded’, function() { $post_type=”foo”; add_action( ‘registered_post_type’, function( $registered ) use ( $post_type ) { if ( $registered !== $post_type ) … Read more

wp_nav_menu sort order?

I just found this handy little function that ads the ability to reverse the menu output order. it might come in handy: /** * Enables a ‘reverse’ option for wp_nav_menu to reverse the order of menu * items. Usage: * * wp_nav_menu(array(‘reverse’ => TRUE, …)); */ function my_reverse_nav_menu($menu, $args) { if (isset($args->reverse) && $args->reverse) { … Read more

Deleted pages are NOT removed from custom menus?

Empty your trash 🙂 Pages are not removed from the custom menus until they’ve been deleted completely. I’ve tested it right now. Creating a complex nav menu can take a very long time and the pages can be bulk deleted in a sec. I believe WordPress is just trying to save you all the trouble … Read more

Show current navigation path from menu

The best way would be to use wp_nav_menu with a custom walker. Prerequisites: Registered theme location Menu saved to that theme location Useage Wherever you want the breadcrumbs (for theme location ‘primary’): <?php wp_nav_menu( array( ‘container’ => ‘none’, ‘theme_location’ => ‘primary’, ‘walker’=> new SH_BreadCrumbWalker, ‘items_wrap’ => ‘<div id=”breadcrumb-%1$s” class=”%2$s”>%3$s</div>’ ) ); ?> The custom walker … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)