• Resolved wirthdesign

    (@wirthdesign)


    Through searching I have found this code here…

    <?php
    $child_pages = $wpdb->get_results("SELECT *  FROM $wpdb->posts WHERE post_parent = ".$post->ID."   AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>
    
    <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
    
    <?php the_content(); ?>	
    
    <?php endforeach; endif;
    ?>

    Now what I am looking for is to display specific child pages and not all of them. I am using this as a CMS so that the admin can edit a child page and have the content on the parent page update.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter wirthdesign

    (@wirthdesign)

    and I want to display the content of the child page not a link to it

    I did something very similar on a site a while back. I’ve dropped a copy of the custom page template I used in the pastebin:

    http://wordpress.pastebin.ca/1829255

    Hope that helps.

    Thread Starter wirthdesign

    (@wirthdesign)

    hmmm I regret that I dont know exactly what I am looking at there. I’m still a noob at PHP 🙁

    It’s a custom page template. When applied to a page that has children, it will show the contents of the child pages.

    Thread Starter wirthdesign

    (@wirthdesign)

    Now the dilemma I have with this is I need to display the Parent Page content then in a separate div “A” Child page contents then in a separate div “B” Child Page contents.

    http://wordpress.pastebin.ca/1829293

    Amended to place the parent’s content in its own div. Each child page did have it’s own div block but now has a unique class attached to it as well.

    Great this seems to be the right type of template for me. Only 1 problem (I´m a noob at php as well). In my previous template for the childpages I used 2 specialtags:

    To use a alternate title: <?php $altrubrik = get_post_meta($post->ID, ‘altrubrik’, $undersida = true); ?>

    and then

    <?php echo $altrubrik ?>

    To use a second content: <?php get_the_content_2(); ?>

    and then:

    <?php the_content_2(); ?>

    When I try to implement these into your code I can´t get it to work, ideas where and how to put it in?

    KGD2006 – please start another topic with that question and put all the template code you are using in a pastbin and report that pastebin link in the thread you start. Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Displaying Specific Child Contents on Parent Page’ is closed to new replies.