Skip to content

Instantly share code, notes, and snippets.

@domantasg
Created September 22, 2017 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domantasg/e529b692fa8776c7859f162ab8667a14 to your computer and use it in GitHub Desktop.
Save domantasg/e529b692fa8776c7859f162ab8667a14 to your computer and use it in GitHub Desktop.
/ 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