Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. global $wp_query;
  2. $wp_query->set('order', 'ASC');
  3.  
  4. add_action('pre_get_posts','myf88');function myf88($query) {
  5. if ( !is_admin() && $query->is_main_query() ) {
  6. if ( $query->is_category ) {
  7. $query->set('post_type', array('post','page','my_postType') );
  8. add_filter( 'posts_where' , 'MyFilterFunction_1' );
  9. }
  10. //for "PAGE" type, this doesnt work (IT is WORDPRESS FAULT) , so you may modify "query_posts" in page.php,before loop
  11. }
  12. }
  13. function MyFilterFunction_1($where) {global $wpdb; $where .= " AND ({$wpdb->posts}.post_name NOT LIKE 'Journal%')"; return $where; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement