Guest User

Untitled

a guest
Jan 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. add_filter('pre_get_posts', 'query_post_type');
  2. function query_post_type($query) {
  3. if ( is_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
  4. $post_type = get_query_var('post_type');
  5. $post_types = get_post_types();
  6. if($post_type)
  7. $post_type = $post_type;
  8. else
  9. $post_type = $post_types;
  10. $query->set('post_type',$post_type);
  11. return $query;
  12. }
  13. }
  14.  
  15. add_filter('widget_posts_args', 'wpsites_modify_recent_posts_widget');
  16. function wpsites_modify_recent_posts_widget($params) {
  17. $params['post_type'] = array('post', '$post_type');
  18. return $params;
  19. }
Add Comment
Please, Sign In to add comment