Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

WP 3.2.1

The title just about says it all. I'd like to make a parent page of the blog that will dynamically show a little teaser of certain entries (either the most recent or random, depending on what my client wants). Is something like this possible? If so, how?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you're wanting to display some posts but not have it function like the blog (with the prev/next links) then this should do the trick.

<?php global $post; $args = array( 'numberposts' => 10, 'post_type' => 'post', ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    [act like it's the loop]
<?php endforeach; ?>

So then you could do something like...

<?php global $post; $args = array( 'numberposts' => 10, 'post_type' => 'post', ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?>
    <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php if ( has_post_thumbnail() ) { echo '<div class="featured-thumbnail">'; the_post_thumbnail(); echo '</div>'; } ?>
    <?php the_content(); ?>
<?php endforeach; ?>

If I understand what you're wanting to accomplish correctly, then this'll do it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.