Tag Info

New answers tagged


when you upload image to WordPress you must to fill Title field. and also your theme must use default WordPress thumbnail function.


get_post_ancestors() returns all of the ancestors hierarchically. As you only want to display the 2nd level post title on 4th post page, you can do something like - global $post; $parents = get_post_ancestors( get_the_ID() ); if( count($parents) == 4 ){ // ancestor1 = 1st parent, ancestor2 = second. echo get_the_title($parents['1']); // index ...


The function you are looking for is get_post_ancestors() According to the documentation it returns an array of the ancestor page IDs


Replace $page->post_title; with $item->title; to get the menu item's label

Top 50 recent answers are included