• i’m not quite sure how to do what I want to achieve.

    I would like the title and excerpt of my sub pages (not posts) to be listed on the parent page but don’t know what tags to use to do this.

    eg:

    Parent Page is “England”

    Sub pages are articles on “London”, “liverpool”, “Bristol”, “Manchester” etc

    can anyone assist me?

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • I haven’t actually tested this, but maybe something like this:

    $pages = $wpdb->get_results("
    	SELECT * from $wpdb->posts
    	WHERE post_type='page'
    	AND post_parent=$post->ID
    	ORDER BY post_title
    	");
    
    foreach($pages as $page) :
    	echo '<h2><a href="' .  get_permalink($page->ID) .  '" title="' . $page->post_title . '">' . $page->post_title .  '</a></h2>';
    	echo '<p>'; the_excerpt(); echo '</p>';
    endforeach;

    There may be less complicated ways of doing this.

    Thread Starter ignitionmedia

    (@ignitionmedia)

    Thanks heaps for your reply and help. I really appreciate it.

    I have added your code and it works to a point… each sub page title is printed correctly, however when pulling the excerpt instead of displaying the excerpt it shows “Object” – Does this mean anything to you?

    It means that the excerpt doesn’t work with Pages. Normally, unless you query directly the database as the code above does, there is no “multi-Page view” in WordPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Template Tag help; display sub page excerpts on parent page’ is closed to new replies.