daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top