Skip to content

Instantly share code, notes, and snippets.

@hasinhayder
Last active December 19, 2015 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasinhayder/5886783 to your computer and use it in GitHub Desktop.
Save hasinhayder/5886783 to your computer and use it in GitHub Desktop.
Change number of posts displayed in WordPress blog page by weekdays
function number_of_posts_per_day($query){
if (date("l")=="Sunday") {
$query->set('posts_per_page', 20);
}
elseif (date("l")=="Monday") {
$query->set('posts_per_page', 10);
}
elseif (date("l")=="Tuesday") {
$query->set('posts_per_page', 5);
}
return $query;
}
add_filter('pre_get_posts', 'number_of_posts_per_day');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment