How to Show WordPress Pages on Your Homepage

How to Show WordPress Pages on Your Homepage


If you ever wanted your Pages to show up in the stream of Posts on your homepage, then it’s easily done. Just add the following code to your functions.php file. (Appearance > Editor > Theme Functions – functions.php)

add_filter( 'pre_get_posts', 'my_get_posts' );
 function my_get_posts( $query ) {
 if ( is_home() && false == $query->query_vars['suppress_filters'] )
 $query->set( 'post_type', array( 'post', 'page') );
 return $query;
 }

 

Or, if you prefer, you could make your own simple little plugin to do this in two minutes. See this post for instructions.

Why Would You Want to Do This?

The question naturally arises – why would you want to make Pages act like Posts? Well, there’s no telling. People bend and twist and hammer WordPress in all sorts of ways for their purposes. But it’s important to remember that this doesn’t stop Pages from being Pages. It simply publishes them to the stream on the homepage when you first create them. Some, especially those who primarily or exclusively use Pages on their sites instead of Posts, may want that.

 

Photo: Information Super Highway from BigStock