Title: get_posts php issue
Last modified: August 19, 2016

---

# get_posts php issue

 *  Resolved [goldmember](https://wordpress.org/support/users/goldmember/)
 * (@goldmember)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/get_posts-php-issue/)
 * on this PAGE of my site ([http://greenrefurbishing.com/wordpress/blog/](http://greenrefurbishing.com/wordpress/blog/)),
   I have the php code below pasted in the HTML content editor of the PAGE in order
   to show the entire most recent post to the Blog category (category 1).
 * but for some reason, the title of the post does not appear, even though the Posted
   On date does, and so does the content.
 * how do I get the post title to appear? Please advise. Thanks!
 *     ```
       <?php
       $latestposts = get_posts('numberposts=1&category=1');
       foreach($latestposts as $post) :
          setup_postdata($post);
       ?>
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
       <?php twentyten_posted_on(); ?><br />
       <br />
       <?php the_content(); ?>
       <?php endforeach; ?>
       ```
   

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

 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/get_posts-php-issue/#post-1676663)
 * This code should really be placed in the theme template file for the home page
   and not in the edit page area of the admin.
 *  [Michelle Langston](https://wordpress.org/support/users/chellycat/)
 * (@chellycat)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/get_posts-php-issue/#post-1676664)
 * Yes, you always will place this kind of code directly in the template files. 
   The HTML content editor is only for entering post/page content.
 * You’ll need to go to Appearance > Editor and then find “index.php” (assuming 
   you want the latest post to show on the front page) for your current theme. That’s
   the file where this code should go!
 *  Thread Starter [goldmember](https://wordpress.org/support/users/goldmember/)
 * (@goldmember)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/get_posts-php-issue/#post-1676673)
 * ok. thanks.

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

The topic ‘get_posts php issue’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [goldmember](https://wordpress.org/support/users/goldmember/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/get_posts-php-issue/#post-1676673)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
