Post by custom days without array

This is under plugins function

http://wordpress.stackexchange.com/questions/54142/check-post-date-in-pre-get-posts

query_posts(array(
‘post_type’ => ‘movies’,
‘event_categories’ => $spot_category,
‘posts_per_page’ => -1
));

Now i add in functions.php using hook

http://devotepress.com/wordpress-coding/when-to-use-pre_get_posts-in-wordpress/#.VO8EaTWli1G

function popular_posts_weekly_custom($query) {
if (function_exists(‘vh_spotlight’)){
$today = getdate();
$query->set( ‘orderby’, ‘comment_count’);
$query->set( ‘day’, $today[‘mday’] );
}
}
add_action( ‘pre_get_posts’, ‘popular_posts_weekly_custom’ );

Advertisements

Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: