Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Making a Sticky Post stay at the Top of the Blog Page WordPress


Hey guys,

I think I have set all the sticky post options right in my wordpress site, however for some reason when I publish a new post the STICKY post falls below that post.

I am not sure why it is doing this, hopefully one of you can recommend a solution.

Here is the URL of my page, the sticky post has the title "READ FIRST:"



Answers (2)


Luis Abarca answers:

Make a new query and get just sticky posts, that will work too

$sticky = get_option( 'sticky_posts' );
$query = new WP_Query( 'p=' . $sticky[0] );

Justin Rodas comments:

Hi Luis,

thanks for your reply, but I'm not sure what you mean.. Where am I supposed to make this query?

Please explain clear steps as I'm a newbie :)

Luis Abarca comments:

if you changing your template and dectivating your plugins and still dont work for you, try this way.

In a new loop, to just show 1 or as many sticky posts as you want

i.e: tweenty elevent index.php

* The main template file.
* @package WordPress
* @subpackage Twenty_Eleven
get_header(); ?>

<div id="primary">
<div id="content" role="main">

$sticky = get_option( 'sticky_posts' );
$query = new WP_Query( 'p=' . $sticky[0] . '&posts_per_page=1' );

// Show just sticky here
$exclude = array();

<?php if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php $exclude[] = $post->ID; endwhile; ?
<?php endif ?>

<?php query_posts(array('exclude' => $exclude)); // get posts ?>

<?php if ( have_posts() ) : ?>

<?php twentyeleven_content_nav( 'nav-above' ); ?>

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', get_post_format() ); ?>

<?php endwhile; ?>

<?php twentyeleven_content_nav( 'nav-below' ); ?>

<?php else : ?>

<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->

<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->

<?php endif; ?>

</div><!-- #content -->
</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Luis Abarca comments:

make it sure (1) that you (or a plugin) are not forcing a date post order, (2) the "Read First" has the sticky, (3) and the first post doesn't have sticky attribute

Justin Rodas comments:

Thanks Luis!! You've solved my problem! :)

The rest of you thank you also for trying :)


Bogdan answers:

Check this post: Church Street receives more funding from City of Orlando. It might be sticky too. That`s why your post (Read first) is the second one. If not, what plugin you use? If you are not using any plugin, check this

Justin Rodas comments:

Thanks Bogdan, but the "Church Street" post is not sticky, I had already checked on that. I am not using any plug-ins, just the wordpress sticky post option.

Bogdan comments:

In the past, it work? Maybe your theme is "ignoring" the sticky option. If you use that plugin, you`ll not have any problems.

Bogdan comments:

P.S: Try changing the theme and see if work`s the sticky option.

Justin Rodas comments:

Hi bogdan, sorry but it is a live business site and we can not change the theme, we need a solution using the same theme and settings. Any other suggestions?

Bogdan comments:

Justin, when I was telling you to change the theme, it was only to see if the options works with other theme (and then, you can change it back). You can use the code that Luis give you :).

Bogdan comments:

Try the plugin wp-sticky as I said you. If you`re newbie :). It`s easier.