Blog Single

02 Aug

WordPress subpages next and previous with count down


$pageid = get_the_ID();
$subpages = get_pages(array(
'post_type' => 'page',
'sort_column' => 'menu_order',
'order' => 'DESC',
'posts_per_page' => -1,
'child_of' => $post->post_parent,
'offset' >=0
));
$foundon = false;
if(!empty($subpages) && !is_wp_error($subpages))
foreach($subpages as $index=>$p){
if($p->ID == $pageid){
$foundon = $index + 1;
}
}
?>

Pag. ID; echo $foundon.'/'.count($subpages);?>







if(isset($subpages[$foundon])){?>

.

Related Posts