Sticky posts not working
-
Hi there,
Having some issues displaying sticky posts in WordPress. We have recently moved to WordPress 3.0 and I have discovered my sticky posts on the front page have not been displaying correctly (This was working previously in WP 2.7).
When not logged in, you can only see 1 sticky (the eldest sticky) and when logged in you can see all recent stickies. As mentioned before, this was working correctly so I’m unsure what could of happened.
I have double checked these sticky posts and visibility is on public etc.
Here is the code for displaying the stickies:
<?php /* Get all sticky posts */ $sticky = get_option( 'sticky_posts' ); /* Sort the stickies with the newest ones at the top */ rsort( $sticky ); /* Get the 5 newest stickies (change 5 for a different number) */ $sticky = array_slice( $sticky, 0, 5 ); /* Query sticky posts */ $myposts = query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) ); foreach($myposts as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>* <span class="md-date"><?php unset($previousday); printf(__('%1$s', 'sandbox'), the_date('', '', '', false)) ?></span> <?php endforeach; ?>
As mentioned when not logged in, you can see 1 sticky (eldest) so I’m unsure where the problem is occurring.
Hopefully someone can help me out.
Regards,
Lucas
- The topic ‘Sticky posts not working’ is closed to new replies.