Advertisement
ridgey28

WP Add Recent Sticky Posts

Dec 13th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  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. */
  3.  
  4.  
  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>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement