Advertisement
alchymyth

cat template wt fixed posts

May 9th, 2011
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php //structure for category template with a number of fixed posts on top; post IDs in array//
  2. $temp = $post;
  3. fixed_posts_IDs = array(1, 5, 77, 345);
  4. $fixed_posts = get_posts('include=' . implode(',',$fixed_posts_IDs));
  5. foreach( $fixed_posts as $post ) :
  6. setup_postdata($post);
  7. /*whatever you need to show of the fixed posts*/
  8. endforeach;
  9. wp_reset_query();
  10. $post = $temp;
  11.  
  12. $args = array(
  13. 'post__not_in' => fixed_posts_IDs,
  14. 'cat' => get_query_var('cat'),
  15. 'order' => ASC
  16. ); /*add whatever parameters you need*/
  17.  
  18. if( have_posts() ) :
  19. /*normal loop*/
  20. endif; wp_reset_query();
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement