Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_post_type_support( 'page', 'excerpt' );
- function posts_where_excerpt_not_empty( $where ) {
- // on the home page or a category page
- if(is_home() || is_category()){
- $where .= " AND post_excerpt != '' ";
- }
- return $where;
- }
- add_filter( 'posts_where' , 'posts_where_excerpt_not_empty' );
- function my_post_queries( $query ) {
- // not an admin page and is the main query
- if (!is_admin() && $query->is_main_query()){
- // on the home page or a category page
- if(is_home() || is_category()){
- $query->set('post_type', array('post', 'page'));
- }
- }
- }
- add_action( 'pre_get_posts', 'my_post_queries' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement