Advertisement
Guest User

Untitled

a guest
Jun 15th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_post_type_support( 'page', 'excerpt' );
  2.  
  3. function posts_where_excerpt_not_empty( $where ) {
  4. // on the home page or a category page
  5. if(is_home() || is_category()){
  6. $where .= " AND post_excerpt != '' ";
  7. }
  8. return $where;
  9. }
  10. add_filter( 'posts_where' , 'posts_where_excerpt_not_empty' );
  11.  
  12. function my_post_queries( $query ) {
  13. // not an admin page and is the main query
  14. if (!is_admin() && $query->is_main_query()){
  15. // on the home page or a category page
  16. if(is_home() || is_category()){
  17. $query->set('post_type', array('post', 'page'));
  18. }
  19. }
  20. }
  21.  
  22. add_action( 'pre_get_posts', 'my_post_queries' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement