Skip to main content
fixed formatting
Source Link
cjbj
  • 15k
  • 16
  • 42
  • 89

Replace $parent$parent in child_ofchild_of argument of wp_list_pageswp_list_pages by parent->IDparent->ID. wp_list_pageswp_list_pages needs the post id instead of post object.

<?php 
  global $post;
  $direct_parent = $post->post_parent;
  $parent = $direct_parent->post_parent;
  wp_list_pages( array(
   'child_of' => $parent,
   'title_li'     => false,
   'depth' => 1
 ) );
?>

Replace $parent in child_of argument of wp_list_pages by parent->ID. wp_list_pages needs the post id instead of post object.

<?php 
  global $post;
  $direct_parent = $post->post_parent;
  $parent = $direct_parent->post_parent;
  wp_list_pages( array(
   'child_of' => $parent,
   'title_li'     => false,
   'depth' => 1
 ) );
?>

Replace $parent in child_of argument of wp_list_pages by parent->ID. wp_list_pages needs the post id instead of post object.

<?php 
  global $post;
  $direct_parent = $post->post_parent;
  $parent = $direct_parent->post_parent;
  wp_list_pages( array(
   'child_of' => $parent,
   'title_li'     => false,
   'depth' => 1
 ) );
?>
Source Link

Replace $parent in child_of argument of wp_list_pages by parent->ID. wp_list_pages needs the post id instead of post object.

<?php 
  global $post;
  $direct_parent = $post->post_parent;
  $parent = $direct_parent->post_parent;
  wp_list_pages( array(
   'child_of' => $parent,
   'title_li'     => false,
   'depth' => 1
 ) );
?>