Hi, I've been searcging all over to get some code to get the sticky feature working on the sample 'page of posts' from the wp codex site.
I am a bit surprised that the option to allow stickys is pressent (set a variable at the beginning of the template to '0'), but that this doesn't show the stickys on the page.
For anything other than a blog kind of site/page this is quite an essential feature I'd say.
(I must be overlooking something. Any help?)
Thanks.
Put this in your Page Template
<?php
$args=array(
'post__in'=>get_option('sticky_posts'),
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
the_content();
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
Thanks!, I tried something like that but with no luck so far, is this documented somewhere in the codex?
What did NOT work. Paste your complete Page Template in a pastebin such as wordpress.pastebin.com and report the link back here and maybe someone can spot the problem.
Don't think that's in Codex.
Sorry about the confusion, I am sure this will work , what I tryed before did not work I ment. I am not a thorrough breed php coder, (though I occasionally write some working lines of code.)
Thanks for the help.