wp_list_pages Hierarchical Help

After you global $post, you can use the core WordPress function get_post_ancestors() to retrieve the parent pages. Example $ancestors = get_post_ancestors($post); if($ancestors){ foreach(array_reverse($ancestors) as $post_id){ $ancestor_page = get_post($post_id); } } Then, to retrieve all child pages of the current page, you could make it easy by using a custom function. Place your custom function in … Read more

Page thumbnail doesn’t display on navigation

the_post_thumbnail() echos content. This is explicitly stated in the Codex, and the function name follows the WordPress convention (mostly) that function names starting with the_ echo content. Display the Featured Image (previously called Post Thumbnails) for the current post, as set in that post’s edit screen. The thumbnail will display as soon as that line … Read more

How to add scroll IDs to WordPress menu anchors

Thank god.. i’ve solved it my own. this is the function i used to update the anchor tags. function my_walker_nav($item_output, $item, $depth, $args) { $menu_locations = get_nav_menu_locations(); if(!empty( $item->description )) $description = $item->description; else { $description = ”; } if ($item->menu_order == 1){ $item_output = preg_replace(‘/<a /’, ‘<a data-scroll-nav=”‘.$description.'” ‘, $item_output, 1); } return $item_output; … Read more

Custom nav walker: How to acces the $args parameter?

WordPress Walkers aren’t using constructors. They are started up with walk() method which is passed arguments as third argument (confusingly not reflected in method signature). You can capture it into your object’s property with something like this: class Args_Walker extends Walker { public function walk( $elements, $max_depth ) { // we could declare above, but … Read more

Modifying the walker to insert parent’s description above sub menus

If i understand your question correctly, the first thing you would need to do is, go to your menus /wp-admin/nav-menus.php (screen options) and checkbox (tick) on the description. and this is how your walker class should look like class Menu_With_Description extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth … Read more

Walker Class: Output Parent Description and Featured Image right after sub-menu?

Figured it out as I wrote out my question. Love when that happens. Here is the solution if someone needs this for the future. I simply just wrapped the desired output in a conditional to match the depth I needed. Viola> if ( 0 == $depth ) { $item_output .= “\n$indent<div class=\”dropdown\”><div class=\”container\”><div class=\”thumbnail\”>”.$thumbnail.”</div><div class=\”nav-info\”>” … Read more

Extend Menu Walker Output

change this line: $item_output .= $args->link_before . apply_filters(‘the_title’, $item->title, $item->ID) . $args->link_after; to: $item_output .= $args->link_before . apply_filters(‘the_title’, substr($item->title, 0, 10), $item->ID) . $args->link_after; That limits the character to 10. Please note this substr($item->title, 0, 10).

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