Title: Manipulating Theme Templates
Last modified: August 19, 2016

---

# Manipulating Theme Templates

 *  [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/)
 * Hi
 * I have added the following code to my page.php file in order to list my post 
   summaries at the bottom of page ID 10:
 * `<?php if(is_page(10)){ include(TEMPLATEPATH . '/homepage.php'); } ?>`
 * In homepage.php I want to call for a summary of the posts. Is this the best way
   to do this?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759815)
 * I think the best way would be to create a different page template instead.
 *  Thread Starter [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759853)
 * Great have done that. Have also added code to show the last ten posts. I can’t
   seem to find any info however on adding a summary of each post underneath the
   titles?
 *     ```
       <ul><?php $myposts = get_posts('numberposts=10');
       foreach($myposts as $post) :
       ?>
       <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
       <?php endforeach; ?></ul>
       ```
   
 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759862)
 * How about `<?php the_excerpt(); ?>` ?
 *  Thread Starter [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759903)
 * That seems to just display the current page text.
 * So I get:
 * – News Title 1
    Current Page Text – News Title 2 Current Page Text
 * I need to be able to display the excerpts of the particular news stories.
 * i.e.
    – News Title 1 News 1 Text Excerpt – News Title 2 News 2 Text Excerpt
 * Thanks again for your replies by the way… appreciate it.
 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759937)
 * You can use the setup_postdata(); function to setup all the necessary variables…
   like this:
 *     ```
       <ul><?php $myposts = &get_posts('numberposts=10');
       foreach($myposts as $post) :
       setup_postdata($post);
       ?>
       <li>
           <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
           <br /><?php the_excerpt(); ?>
       </li>
       <?php endforeach; ?></ul>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Manipulating Theme Templates’ is closed to new replies.

 * 5 replies
 * 2 participants
 * Last reply from: [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/manipulating-theme-templates/#post-759937)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
