How to display featureds page in wordpress home page?

4.6k Views Asked by At

I'm trying to show specific pages on the homepage of my theme. The idea is show the page, the featured image and the excerpt. To do this with categories is relatively easy. But with pages, how should I proceed?

Example of page two pages:

http://bit.ly/KO7uLa http://bit.ly/KwKB2d

Thanks!

1

There are 1 best solutions below

2
On

To do this follow below steps:

  1. Create a page template for your home page. In this template you can add anything what you needed to show on home page.
  2. Now Create a page for home from WordPress dashboard and Assign the template you created now for that page.
  3. Go to settings-> Reading-> Click Front page displays as static page and select the page we created now for Home page.

Codes for your template page

Put the below code in your template file to display the title and excerpt and featured image of a particular page.

<?php
$post_id = 1;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo get_the_post_thumbnail($post_id);
echo "<h2>" . $title . "</h2>";
echo "<p>" . $queried_post->post_excerpt . "</p>";
?>

Make sure to change the post_id.

Hope this will help you.

Cheers !!!