• I have a much larger problem I posted on another forum (still unanswered) which I might be able to solve if I can find a way to target the grandchild (or third level post) of a parent post.

    Right now, this code:

    $Pages = wp_list_pages('child_of='.($post->post_parent != false ? $post->post_parent : $post->ID).'&title_li=&echo=0')
    
        echo $Pages;

    Will show 2nd and 3rd level pages (bold=visible in submenu).

    • Home
    • Parent (active page)
    • Child
    • Grandchild

    I need to find a way to preform a str_replaceon the grandchild.

    I know how to target the child, but basically need to do the exact same thing for the grandchildren.

    $Pages = wp_list_pages('child_of='.($post->post_parent != false ? $post->post_parent : $post->ID).'&title_li=&echo=0')
    
        $Pages = str_replace($Pages,
    						 '<ul id="test">'.$Pages.'</ul>',
    						 $Pages);
    	echo $Pages;
    	unset($Pages);
  • The topic ‘How to target grandchild of post_parent using wp_list_pages’ is closed to new replies.