Created
January 15, 2012 14:59
-
-
Save billerickson/1616098 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'be_listing_type_query' ); | |
/** | |
* Customize the Listing Type taxonomy query | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* @param object $query data | |
* | |
*/ | |
function be_listing_type_query( $query ) { | |
if( $query->is_main_query() && $query->is_tax( 'otf_listing_type' ) ) { | |
$meta_query = array( | |
'key' => '_oft_ad_level', | |
'value' => 'free', | |
'compare' => '=' | |
); | |
$query->set( 'meta_query', $meta_query ); | |
$query->set( 'posts_per_page', '7' ); | |
$query->set( 'orderby', 'title' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment