Undefined offset: 2

You will have those notices, if either of those $pages indexes are not set. Check for the existence of the key before trying to use it. if (isset($pages[$current-1])) $prevID = $pages[$current-1]; if (isset($pages[$current+1])) $nextID = $pages[$current+1]; Or something along these lines … $prevID = (isset($pages[$current-1])) ? $pages[$current-1] : ”; $nextID = (isset($pages[$current+1])) ? $pages[$current+1] : … 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

Image menu on responsive WordPress

I’m not sure what you are asking for, but I think you need some general suggestions. So: 1) Websites are made by three layers. WordPress (like others good CMS) creates “only” TEXT menu because this is the (fundamental) semantic layer. 1-b) Then, you can always add a presentation layer (css) or a behaviour layer (javascript) … Read more

Determine if a navigation item has children

You can filter wp_nav_menu_objects and add the classes in one rush. You don’t even need a custom walker for that. add_filter( ‘wp_nav_menu_objects’, ‘add_has_children_to_nav_items’ ); function add_has_children_to_nav_items( $items ) { $parents = wp_list_pluck( $items, ‘menu_item_parent’); foreach ( $items as $item ) in_array( $item->ID, $parents ) && $item->classes[] = ‘has-children’; return $items; } The class has-children will … Read more

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