Display pages instead of posts on Whitespace PRO Home page

Hello, I’m experimenting with the Whitespace theme.
http://my.studiopress.com/themes/whitespace/#demo-full

I really like the way that the post excerpts display on the home page, but I would like to display page excerpts, not posts.

Does anyone have any tips or advice on how to achieve this?

Many thanks,
Tim

Option 1: add the following code in your functions.php file :

function show_pages_on_home( $query ) {
  if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( 'post_type', 'page' );
  }
}
add_action( 'pre_get_posts', 'show_pages_on_home' );

Above code will pull all pages from your site and display on Home page.

Option 2: Wanting to display the selected pages Then try this one

function show_pages_on_home( $query ) {
  if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( 'post_type', 'page' );
    $query->set( 'post__in', array(1,2,3) );  // Replace 1,2,3 by your page ID
  }
}
add_action( 'pre_get_posts', 'show_pages_on_home' );
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.