WordPress.org

Ready to get started?Download WordPress

Forums

Sub pages and template issues (1 post)

  1. NoyG
    Member
    Posted 6 years ago #

    Hi everybody. First, thanks for just being here and helping others. This is my first support request here and I wish to get some answers, if someone might have them :)

    I am using wordpress 2.5.1 and I am trying to create a page template, in which I can display the page's child pages. Since there is no "loop" for pages, I am using this piece of code:

    <?php
    				$pageChildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
    				if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild );
    			?>
    				<?php echo ($pageChild["post_title"]); ?>
    				<?php the_excerpt(); ?>
    				<div style="clear:both; border-bottom: 1px solid red;"></div>
    				<?php endforeach; endif; ?>

    now, this isn't working out very well although I have tried many different variations. I always get the same - the page stops loading ('dies') at echo ($pageChild["post_title"]);, but if I mark that as comment then the_excerpt(); function is working properly.

    I really don't know what to do next. I would be more then happy if someone could explain that to me or provide some alternative way..

    thanks again. ^_^

Topic Closed

This topic has been closed to new replies.

About this Topic