/*
* Setup the Index page, main query adjustments
*
* If we're viewing the site index get the first 5 posts
* from the "Marquee" category (home-slider), ordered
* by our meta value and ignoring any sticky stuff.
*
*/
function mnsu_index_query( $query ) {
if ( is_home() && $query->is_main_query() ) {
// Set paging to 5
$query->set( 'posts_per_page', '5' );
$query->set( 'ignore_sticky_posts', 1 );
// Get posts from the Marquee category
$tax_query = array (
array(
'taxonomy' => 'placements',
'terms' => array( 'home-slider' ),
'field' => 'slug',
)
);
$query->set( 'tax_query', $tax_query );
$query->set( 'meta_key', 'mnsu_placement_home-slider' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', 'mnsu_index_query' );