-
-
Save billerickson/512d800473d32f506239aed82874d597 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Only show today's posts | |
* | |
*/ | |
function be_today_posts( $query ) { | |
if( $query->is_main_query() && ! is_admin() && $query->is_home() ) { | |
$date_query = array( array( 'after' => '-1 day' ) ); | |
$query->set( 'date_query', $date_query ); | |
} | |
} | |
add_action( 'pre_get_posts', 'be_today_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment