• How do you display the title of your top 3 recent blog posts in your sidebar along with a little paragraph about the post?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Something like this in your sidebar.php

    <?php
    $posts=get_posts('post_type=post&amp;showposts=3');
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>
    <?php the_time('m.d.y') ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    
    <?php the_excerpt(); ?>
    <?php }
    }
    ?>

    Note until Automattic fixes the forum, code is somewhat mangled so the “$post=…” should be:

    $posts=get_posts(‘post_type=post&showposts=3’);

    What’s the rest of the code?

    This partially works, but it replaces the content area as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Recent Blog Posts in Sidebar’ is closed to new replies.