Advertisement
tzvij

home page periodical publishing

Dec 1st, 2013
1,436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. function mag_front_page_filter( $query ) {
  2.  
  3. if ( $query->is_home() && $query->is_main_query() ) {
  4. if ( !get_query_var( 'issue' )){
  5. $tax_query = array(
  6. array(
  7. 'taxonomy' => 'issue' ,
  8. 'field' => 'slug',
  9. 'terms' => mag_get_current_issue(),
  10. )
  11. );
  12. $query->set( 'tax_query' , $tax_query);
  13. }
  14. }
  15. }
  16.  
  17. // register the filter
  18. add_action( 'pre_get_posts', 'mag_front_page_filter' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement