Satch3000
Satch3000

Reputation: 49384

Wordpress show posts code isn't showing any posts

I am using this code to show 5 posts (any post's would do)

<div id="featured-post-section">
    <div id="post-list">1
    <?php query_posts( 'posts_per_page=5' ); ?>2

As you can see, I've added a 1 and 2 numbers.... One before and one after ... I only get 1 2 ... No posts are showing at all.

What am I doing wrong?

Upvotes: 0

Views: 54

Answers (1)

Marc B
Marc B

Reputation: 360592

That function only tells Wordpress how many posts to output. You still have to use the WP loop to actually perform the output.

<?php

// The Query
query_posts( 'posts_per_page=5' );

// The Loop
while ( have_posts() ) : the_post();
    echo '<li>';
    the_title();
    echo '</li>';
endwhile;

// Reset Query
wp_reset_query();

Upvotes: 1

Related Questions