Is there a way to show just 1 post per page on a particular category post page?
ThemeShaper Forums » Thematic
How to show just 1 post per page on a particular category post page?
(4 posts)-
Posted 2 years ago #
-
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 2 years ago # -
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; } } add_action('thematic_above_categoryloop','my_cat_archive_post_limit');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; } } add_action('thematic_above_indexloop','my_custom_query');-Gene
Posted 2 years ago # -
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 2 years ago #
Reply
You must log in to post.