Creating Custom navigation in wordpress with sub menus

Here is your walker class class Description_Walker extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent<nav class=”dropdown-list w-dropdown-list”>\n”; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $classes = empty($item->classes) ? array () : (array) $item->classes; … Read more

How do I get_the_content in a custom walker?

For anyone who might be looking for the same thing, this is what I did in the end: I abandoned the Custom Walker idea and used wp_get_nav_menu_items to get a list of post IDs from my custom menu, from this tutorial on Digging into WordPress: http://digwp.com/2011/11/html-formatting-custom-menus/ In my functions file, I created this function: function … Read more

Manual use of Walker_Category class

the Walker_Category class you are using requires 3 params in walk() method, the third param will be use_desc_for_title value (this is due to how Walker_Category::start_el() method is written). In other words, to use the walk() method without generating a notice you should change your last line to print_r( $walk->walk( $menu_items, -1, -1 ) ); The … Read more

List pages to show only Whitelisted sub pages

The easiest thing to whitelist page IDs for wp_list_pages() is to use a self removing/single time running filter callback inside get_pages(), which is the function retrieving the data from either Cache or from a fresh query to the DB. You have several options in there: Filter the final DB result To filter the list of … Read more

Limit Custom Crawler to front end only

You can try the !is_admin() so your code would be: function wpse31748_exclude_menu_items( $items, $menu, $args ) { // Iterate over the items to search and destroy if ( !is_admin() && is_user_logged_in() ) { $registerpage = get_page_by_title( ‘Register’ ); $loginpage = get_page_by_title( ‘Login’ ); foreach ( $items as $key => $item ) { if ( $item->object_id … Read more