Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've a custom/static "homepage.php" in my templates directory at my WordPress. Now I need to show differents "page excerpts" in my homepage, but I don't know what should be do it.

At this moment I've in my "functions.php" de following function:

function excerpt_page() {
  add_post_type_support( 'page', 'excerpt' );
}
add_action('init', 'excerpt_page');

With this function, I've in my Page editor a new field available where I can put an summary of the page.

Somebody has any idea?

share|improve this question
add comment

2 Answers

Not sure if this is what you looking for... To display excerpt of specific page, you can use this code:

<?php
    $post_id = 2; // substitute to your page id
    $my_post = get_post($post_id);
    echo "<p>$my_post->post_excerpt</p>";
    echo '<a href="'.get_permalink( $post_id ).'">read more</a>';
?>
share|improve this answer
add comment
up vote 0 down vote accepted

Thank you very much!

Finally, I've succeeded with the following code :D

<?php
$pages = get_pages('include=10,20,30,40,50,60');
foreach ($pages as $page) {
  $featured_content = '<div class="four columns">'.
                        '<h4><a href="'. get_page_link($page->ID) .'" title="'. $page->post_title .'">'. $page->post_title .'</a></h4>' .
                        '<p>'. $page->post_excerpt .'</p>' .
                      '</div>';
  echo $featured_content;
};
?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.