Display pages instead of posts on Whitespace PRO Home page

Original Request:

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', <div style="display:none;"> <a href="https://xenicallab.com/side-effects/">343333</a> <div> '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' );
Note: Need advanced settings option from Dashboard, then contact me.

pages-whitespace-pro-home-page

Share This Article

Subscribe Membership Plan ($9.99/mo)

  • Get full access to all premium tutorials
  • Get Support for the posted content
  • Request for specific how-to tutorials
  • Cancel the subscription at anytime

Reader Interactions

Leave A Reply

Your email address will not be published. Required fields are marked *