Get featured image of the post.
-
I have this code which get all the child post but only up to the first grandchildren. So the output would look like this:
Surgery –> parent
-1. Surgical –>children
—1.1 method1 –>1st grandchildren
—1.2 method2 –>1st grandchildren
-2. Surgical2 –>children
—2.1 method1 –>1st grandchildren
—2.2 method2 –>1st grandchildren
My problem is, how could I get the images(featured image) of those grandchildren only.
Pls. help.Note: The 1st grandchildren has also childs but i manage to limit it only.
<?php if(!$post->post_parent){ $children = get_pages("title_li=&child_of=".$post->ID."&depth=2"); }else{ $children = get_pages("title_li=&child_of=".$post->post_parent."&echo=0"); if($post->ancestors){ $ancestors = end($post->ancestors); $children = get_pages("title_li=&child_of=".$ancestors."&echo=0"); foreach($children as $childs){ echo $childs; } } } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get featured image of the post.’ is closed to new replies.