1

I have a custom home page, a blog page which includes a dynamic preview area of the latest 5 blogs, and some other miscellaneous pages. Im trying to design an "events" page where the main page has a sidebar that looks like this:

http://imgur.com/ezEIApD

You can then click on each section, which will open up and have a brief description of the event taken from the page with a read more link to go to that page.

http://imgur.com/Gz9RDYx

I have a parent page called "Events Main" and then I have some test pages set up as child pages of the "Events Main" page.

How I could go about querying child pages to fill in that content dynamically?

I'm currently using this code

$page_id = 85;
$page_data = get_page( $page_id );
$content = $page_data->post_excerpt;
$title = $page_data->post_title;
echo $page_data->post_title;
echo $page_data->post_excerpt;

but I have to go in and fill the page ID number for each section. I need it to automatically populate these fields, so whenever a new child page is added it will show up.

Im using a very similar method in the blog part of my page where anytime a new post is added, the shows up on the blog home page and i can then click it to go to the actual post using this code:

    <?php query_posts("posts_per_page=5"); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div style="color:#fff;" <?php post_class() ?> id="post-<?php the_ID(); ?>">


        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>    </h2>
        <div id="imageScript"><?php if ( function_exists( 'get_the_image' ) ) { get_the_image(); } ?></div><!-- END imageScript -->
        <div class="entry">
            <?php the_excerpt(); ?>
        </div>
        <div id="meta"><?php include (TEMPLATEPATH . '/inc/meta.php' ); ?></div><!-- END meta -->
    </div>

<?php endwhile; ?>

<?php else : ?>

    <h2>Not Found</h2>

<?php endif; ?> 

How to do that?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.