Showposts Loop
-
I’m trying to show the 5 recent posts in my bar with this loop:
<?php query_posts(‘showposts=5’); ?>However, it changes my main index content from showing 3 blog posts to 5 posts.
Is there a way to show recent posts in my sidebar without it interfering with my main content?
Note: I do not want to use the “recent posts” widget because I am using my own alteration of the loop. Example below:
<?php query_posts('showposts=5'); ?> <ul> <?php while (have_posts()) : the_post(); ?> <li class="latestpost"> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> <br /><span class="latestpostmeta"><?php the_time('M jS, Y') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> </span></li> <?php endwhile; ?> </ul>
You can view it at https://kisschanel.com/blog, located under “Recent Posts” in the sidebar.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Showposts Loop’ is closed to new replies.