Custom walker pulldown display current page

WordPress add “current-menu-item” class for the active menu item, you could check if this class is set and the set the option for that item be selected. class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu { function start_lvl($output, $depth) { } function end_lvl($output, $depth) { } function start_el($output, $item, $depth, $args) { // Here is where we create each … Read more

how to make a walker to this (in bootstrap, i try but not work)

I use this navwalker <?php class wp_bootstrap_navwalker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( “\t”, $depth ); $output .= “\n$indent<ul role=\”menu\” class=\” dropdown-menu\”>\n”; } public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth … Read more

custom walker to add iconfont to wp_nav_menu

ok, I figured it out myself. instead of using the CSS class (as I cannot figure out how to filter it), I decided to use the description instead. under the lines with $attributes I have added this line: $description = ! empty( $item->description ) ? esc_attr( $item->description ) : ”; And then I added that … Read more

Custom Links in Walker Class

Test for … $item->object=”custom” This is used for custom links only. $item->object is always the post type or the item type (category for example). Not sure what happens when someone registers a custom post type named custom 🙂

Use wp_nav_menu to dynamically generate child menus

My solution uses the Walker_Nav_Menu and a custom class and is mostly hacked together from this post: How do I dynamically populate wp_nav_menu from a custom taxonomy? Solution: //define the custom post type //could use “page” or “post” as well. define(“MENU_CPT”, “action”); //custom function for selecting posts based on a page parent (ne’ term_id) function … Read more

Walker for menus

All of the methods are being overridden when you load your own walker, but typically you would extend another Walker which works a bit like “filtering” or “pluggable functions”. Take a look at this very simple walker from another question: class my_extended_walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = array()) { $output … Read more

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