• 1.
    function my_query_for_homepage( $query ) {
  • 2.
    if( $query->is_main_query() && $query->is_home() ) {
  • 3.
    $query->set( 'post_type', array( 'movies' ) );
  • 4.
    }
  • 5.
    }
  • 6.
    add_action( 'pre_get_posts', 'my_query_for_homepage' ); 
function my_query_for_homepage( $query ) { if( $query->is_main_query() && $query->is_home() ) { $query->set( 'post_type', array( 'movies' ) ); } } add_action( 'pre_get_posts', 'my_query_for_homepage' );

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter