Created
September 22, 2017 10:19
-
-
Save domantasg/e529b692fa8776c7859f162ab8667a14 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
/ Hook our custom function to the pre_get_posts action hook | |
add_action( 'pre_get_posts', 'add_reviews_to_frontpage' ); | |
// Alter the main query | |
function add_reviews_to_frontpage( $query ) { | |
if ( is_home() && $query->is_main_query() ) { | |
$query->set( 'post_type', array( 'post', 'movie', 'review' ) ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment