WordPress.org

Ready to get started?Download WordPress

Forums

how can i display 5 articles without limitation in setting (4 posts)

  1. blurfun
    Member
    Posted 1 year ago #

    Here is the code i have now

    <?php query_posts('cat=1&paged='.get_query_var('paged'));?>
    	<?php if (have_posts()) : while (have_posts()) : the_post();?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                <h2 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
      </div> <!-- end of post ID -->
    	<?php endwhile; ?>
    	<?php else : ?>
    		<h2>Not Found</h2>
    	<?php endif; ?>
    <?php wp_reset_query();?>

    Thanks a lot :)

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    add the 'posts_per_page' parameter into the query:

    http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters

  3. ActiveCanvas
    Member
    Posted 1 year ago #

    Similarly I want to limit the number of posts on my home page to the latest 3 posts. Into which file do I add the 'posts_per_page' parameter into the query?

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    @ActiveCanvas

    please start your own topic.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.