WP Add Recent Sticky Posts

Dec 13th, 2016
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php /* Add option to filter WordPress sticky posts only in:  [url] http://www.worldoweb.co.uk/2012/display-your-wordpress-recent-posts-on-a-static-page
  2. */
  5. $args = array( 'numberposts' => 6, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
  6. $postslist = get_posts( $args );
  7. echo '<ul id="latest_posts">';
  8.  foreach ($postslist as $post) :  setup_postdata($post); ?>
  9.   <?php if (is_sticky()){?>
  10.     <li><strong><?php the_date(); ?></strong><br />
  11.     <a href="<?php the_permalink(); ?>" title="<?php the_title();?>"> <?php the_title(); ?></a>
  12. </li>
  13. <?php } endforeach; //end if_sticky() and foreach()?>
  14.  </ul>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.