WordPress.org

Support

Support » How-To and Troubleshooting » Why does ‘hierarchical’ not work in Get_Pages?

Why does ‘hierarchical’ not work in Get_Pages?

  • so i have this page that has to show ONLY the children of the present parent, not the grandchildren.
    after a long search i found this code:

    <?php $pages = get_pages('child_of='.$post->ID.'&sort_column=menu_order&hierarchical=0');
    				$count = 0;
    					foreach($pages as $page) {
    					$content = $page->post_content;
    				if(!$content)
    					continue;
    				if($count >= 8)
    					break;
    			$count++;
    					$content = apply_filters('the_content', $content);
    			?>
    			<li><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a>
    				<div class="locationentry"><?php echo $content ?></div>
    			</li>
    		<?php } ?>

    does anyone know why the ‘hierarchical=0’ is not working in Get_Pages or “what is wrong in the get_pages code”?

    if you are looking at this page you have to know that green blocs #2 and #3 are children of green bloc #1

    any help is very welcome, thnx for your time.

Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Why does ‘hierarchical’ not work in Get_Pages?’ is closed to new replies.