ThemeShaper Forums » Thematic


How to show just 1 post per page on a particular category post page?

(4 posts)
  • Started 10 years ago by hally
  • Latest reply from thexander
  • This topic is not resolved
  1. hally

    Is there a way to show just 1 post per page on a particular category post page?

    Posted 10 years ago #
  2. hally

    Currently I am using this code to show just the news category which is on the frontpage:

    query_posts('cat=6'); while ( have_posts() ) : the_post()

    But I am wondering if they is some additional code I could use to limit the number of posts for that category

    Posted 10 years ago #
  3. Hi hally-

    Do you mean to say "just show 1 post per page on a particular category archive page"? If so this should do it for you.

    function my_cat_archive_post_limit() {
      if (is_category('6')) {
        	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
         	query_posts('cat=6 &showposts=1 &paged=' . $paged );
        	$wp_query->is_archive = true; $wp_query->is_home = false;

    If you're trying to do this on the home page of the site you could try this:

    function my_custom_query() {
      if (is_home()) {
        	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
         	query_posts('cat=6 &showposts=1 &paged=' . $paged );
        	$wp_query->is_archive = false; $wp_query->is_home = true;


    Posted 10 years ago #
  4. Hello, I'm trying to set a category to display 100-500 posts. Apparently the function above ceases to work if you set the number above 10.

    Can someone please help?

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.