Support » Fixing WordPress » problem displaying 3 level deep page hierarchy

  • Hi,
    I have created page – “Solutions” , child pages of “Solutions – Design Solutions, Development Solutions & Mobile Solutions” and child pages of each, e.g. “Design solutions – 1. Web Design, 2. Print Design, 3. Logo & Identity, Development Solutions – 1. Web Development, … etc.
    I want to show only last level pages i.e(web design, print design, web development,..) when I go to “Solutions” Page…
    I tried the code, but it also shows the second level pages like Design Solutions and others. I want to hide them or exclude them, I also tried the wp_list_pages() and get_pages() but not working….
    See the code…

    if(have_posts()) : while(have_posts()) : the_post();
    				$parents = get_pages('child_of='.$post->ID.'&parent='.$post->ID.'&hierarchical=0');
    				//$mypages = get_pages('child_of=$parents&exclude=$parents')
    				foreach($parents as $parent)
    					$parent_id[] = $parent->ID;
    				$value = implode(',', $parent_id);
    				//$result = wp_list_pages('child_of='.$post->ID);
    				$query = new WP_Query('post_parent='.$post->ID);
    				while($query->have_posts()) : $query->the_post();

    ….. so on…..

    I also fetched IDs of those 3 posts and used it in parameters with exclude but didn’t work….


Viewing 1 replies (of 1 total)
  • After this line
    $value = implode(',', $parent_id);
    couldn’t this work

    $wlp_param_list='exclude=' . $value;

Viewing 1 replies (of 1 total)
  • The topic ‘problem displaying 3 level deep page hierarchy’ is closed to new replies.