Advertisement
debbie_gadbois

page-listings.php

Aug 22nd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. global $bp, $wp_query, $post, $paged;
  4.  
  5. $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
  6.  
  7. $original_query = $wp_query;
  8.  
  9. $query_args = array(
  10. 'post_type' => 'directory_listing',
  11. 'post_status' => 'publish',
  12. 'paged' => $paged,
  13. 'orderby'=> 'title',
  14. 'order' => 'ASC',
  15. );
  16.  
  17.  
  18. //setup taxonomy if applicable
  19. $tax_key = (empty($wp_query->query_vars['taxonomy'])) ? '' : $wp_query->query_vars['taxonomy'];
  20. $taxonomies = array_values(get_object_taxonomies($query_args['post_type'], 'names') );
  21.  
  22. if ( in_array($tax_key, $taxonomies) ) {
  23. $query_args['tax_query'] = array(
  24. array(
  25. 'taxonomy' => $tax_key,
  26. 'field' => 'slug',
  27. 'terms' => get_query_var( $tax_key),
  28. )
  29. );
  30. }
  31.  
  32. //Remove the archive title filter for the individual listings
  33. remove_filter( 'the_title', array( &$this, 'page_title_output' ), 10 , 2 );
  34. remove_filter( 'the_content', array( &$this, 'listing_list_theme' ) );
  35.  
  36. query_posts($query_args);
  37.  
  38. if ( file_exists( get_template_directory() . "/loop-taxonomy.php" ) )
  39. get_template_part( 'loop', 'taxonomy' );
  40. else
  41. load_template( DR_PLUGIN_DIR . 'ui-front/general/loop-taxonomy.php' );
  42.  
  43. if(is_object($wp_query)) $wp_query->post_count = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement