Check is category parent with ids from the childs – get_term_children

Sry, here is my answer: Here is first the output for listing the category in checkbox: Walker for the Category Output class Adv_Multicheck_Walker_Category extends Walker { var $tree_type=”category”; var $db_fields = array (‘parent’ => ‘parent’, ‘id’ => ‘term_id’); function start_lvl($output, $depth, $args) { if ( ‘list’ != $args[‘style’] ) return $output; $indent = str_repeat(“\t”, $depth); … Read more

How to exclude/remove submenu using Walker_Nav_Menu

Filter ‘wp_nav_menu_objects’ would help: add_filter( ‘wp_nav_menu_objects’, ‘remove_sub_items’, 10, 2 ); function remove_sub_items( $items,$args ) { $new_items = array(); for ($i=1;$i<count($items)+1;$i++){ //is lvl0 if(empty($items[$i]->menu_item_parent)){ $new_items= array_merge($new_items, nav_tree($items[$i],$items)); } } // var_dump($new_items); die(); if( $args->theme_location == ‘primary’ ) return $new_items; return $items; } function nav_tree($parent,$items){ $rtn = array(); $rtn[] = $parent; //Edit this conditional, return menu level … Read more

Costum walker with sub menu item count

Inside the function your $x is local. You might want to use a static variable: class Walker_Nav_Menu_Costum extends Walker_Nav_Menu { static $x = 0; function end_el( &$output, $item, $depth = 0, $args = array() ) { if ( 1 == $depth ) self::$x++; $output .= “<!– x:”.self::$x.”–>”; $output .= “</li>\n”; } }

How to get current pages menu text?

You can get a Menu’s entire item list with wp_get_nav_menu_items(). Then, loop through them all and test against the current post_id, and voila, you have all your data. <?php $menu_items = wp_get_nav_menu_items( ‘main-menu’ ); foreach( $menu_items as $item ) { print_r( $item ) ; // see what you can work with // carry on }

alternating classes on wp_list_pages

Consider this a complement to toscho’s solution. I believe that … $this->alternate = ($this->alternate != ‘background_1’) ? ‘background_1’ : ‘background_2′; $css_class[] = $this->alternate; … will do what you want. The difference is that toscho’s solution, using the static keyword, will make that variable static for any instantiation of this walker– that is, all instances will … Read more

custom walker class for own menu?

this time my question is which walker class compatible with this menu structure Yes, you should be able to produce a walker to do that, but if you want markup completely different from what the menu API creates, why are you using the menu API? It is a waste of effort. However, what I would … Read more

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