limit the number of posts on a page that displays only posts from 1 category
-
Hello! I know this question has been asked already and I’ve tried some options, but nothing worked.. maybe because of the way I excluded the posts on this particular page. What I’d like to do is override the WP settings of amount of posts, only for this ‘page blog’ that shows only 1 category. Can I do that?
The template for this category blog looks like this:
<?php /* Template Name: pokkie */ ?> <?php global $more;?> <?php get_header(); ?> <div class="grid_11"> <div id="content"> <?php if (qtrans_getLanguage() == 'en') : ?><h2 style="padding-top: 30px; font-size: 22px;">Commissioned work</h2><p>I'll blog a selection of my illustrations here.</p> <?php else : ?><h2 style="padding-top: 30px; font-size: 22px;">Werk in opdracht</h2><p>Hier blog ik een selectie van mijn illustraties.</p> <?php endif; ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args= array( 'category_name' => 'port', 'paged' => $paged ); query_posts($args); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <?php $front_page_category = get_posts( 'category=portobello' ); if( is_front_page() && $front_page_category ) { foreach( $front_page_category as $post ) { setup_postdata( $post ); /* do loop stuff here */ } } ?> <div class="entry"> <?php the_content('<em>Continue reading →</em>'); ?> </div> <?php if (qtrans_getLanguage() == 'en') : ?><p STYLE="clear: left;" class="portfoliometadata"><?php the_time('d') ?> <?php the_time('M y') ?> </p> <?php else : ?><p STYLE="clear: left;" class="portfoliometadata"><?php the_time('d') ?> <?php the_time('M y') ?> </p> <?php endif; ?> <div class="clearfix"></div> </div> <?php endwhile; ?> <div class="navigation"> <?php if (qtrans_getLanguage() == 'en') : ?><div class="alignleft"><?php next_posts_link('← Older work') ?></div> <div class="alignright"><?php previous_posts_link('Newer work →') ?></div> <?php else : ?><div class="alignleft"><?php next_posts_link('← Ouder werk') ?></div> <div class="alignright"><?php previous_posts_link('Nieuwer werk →') ?></div><?php endif; ?> <div class="clearfix"></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php //get_search_form(); ?> <?php endif; ?> </div> </div> <?php get_sidebar(); ?>
Thanks a million for the one who knows which code to put where!:)
- The topic ‘limit the number of posts on a page that displays only posts from 1 category’ is closed to new replies.