• How could I list links to latest posts from blog inside a sidebar?

    I’ve done this earlier by running following iteration inside sidebar.php. First query all posts and then shout out only five first posts. This works fine until you move your sidebar from right to left. Running query_posts() before the actual Loop screws everything up.

    query_posts('orderby=date'); $iteration = 1;
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    if ( $iteration > 5 ) { break; } else { $iteration++; }
    the_permalink(), the_title(); ...
    endwhile; else:
    _e('Sorry, no posts matched your criteria.');
    endif;

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you can get the regular loop to work fine if you add this line in between the two loops:

    <?php query_posts($query_string); ?>

    That sort of resets the whole thing ??

    If what you want is just a list of the latest post the easiest answer is a widget. I don’t care for the standard widget personally nor the standard rss widget, but KB Advanced RSS Widget IS GREAT! I use it to show my latest stumbles, diggs and entrecard drops find at https://www.bradsotherblog.com

    There is a plugin called recent posts that works pretty well too if you look at the header at https://www.bradstinyworld.com it is what I use to display the posts and could easily be coded for a sidebar as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Listing latest posts’ is closed to new replies.