wordpress - Show children of direct parent without specifying parent id -


in wordpress page want show children of direct parent without wanting specify page

<?php $pages = get_pages('child_of=143'); if ($pages) {     echo '<ul>';     foreach ($pages $page) {         echo '<li><a href="'.get_permalink($page->id).'">';         echo get_the_title($page->id);         echo get_the_post_thumbnail($page->id);         echo '</a></li>';     }     echo '</ul>'; } ?> 

how can grab direct parent

cheers help

you can parent id through following:

$post->parent_post 

so, like:

$parent_id = $post->parent_post; $pages = get_pages('child_of=' . $parent_id); if ($pages) {     ... } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -