WordPress.org

Ready to get started?Download WordPress

Forums

Include Sticky Posts in Total Post Count (2 posts)

  1. web-girl
    Member
    Posted 2 years ago #

    I'm having problems with sticky posts. If I specify 20 posts per page, it displays 20 posts. But, sticky posts are additional to the 20 posts. How can I set up the query so that only 20 total posts show (normal posts and sticky posts). I'm using The Style theme (hence the options) and it is set to 20 posts right now. Should I use the counter? Any help would be appreciated!

    Here's the code I'm using:

    <?php $args=array(
    			'showposts' => get_option('thestyle_homepage_posts'),
    			'paged' => $paged,
    			'category__not_in' => get_option('thestyle_exlcats_recent'),
    			'orderby' => post_date,
    			'order' => ASC,
    		);
    		query_posts($args); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php include(TEMPLATEPATH . '/includes/events.php'); ?>
    			<?php $i++; ?>
                <?php endwhile; ?>
  2. chavo
    Member
    Posted 1 year ago #

    Can you solve these?

    If not, try adding to your $args this line of code:

    'ignore_sticky_posts' => 1

    What it does is to display sticky posts as "normal" posts.

Topic Closed

This topic has been closed to new replies.

About this Topic