Support » Plugin: Sticky Custom Post Types » Sticky posts not being output first

  • Hi,

    This is a lovely plugin and it’s working very well for me, except for one thing: my sticky custom posts are not being pulled out of the flow and placed first! They are just appearing in the regular order of the posts, as if they weren’t sticky at all.

    This is a simplified version of my code:

    <?php // get the most recent posts
    	$lim = get_option('posts_per_page');
    	if( have_posts() ): ?>
    		<section id="itemSummaryList">
    		<?php while( $wp_query->have_posts() ): $wp_query->the_post();
    			<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<h2 class="entry-title"><?php if (is_sticky()) _e('Featured Event: ','mylang'); the_title(); ?></h2>
    				<div class="entry-content">
    					<?php the_excerpt(); ?>
    			<?php endwhile; ?>
    	<?php endif; ?>

    The same code works exactly as expected if I set post_type=post in the query. Can anyone see a reason why it would not work for the custom post type? (And yes, there are sticky custom posts set! The above code outputs “Featured Event: ” before the title of any sticky posts, so I can see that the sticky flag is being picked up.)

  • The topic ‘Sticky posts not being output first’ is closed to new replies.