Title: Embed only the latest post
Last modified: August 18, 2016

---

# Embed only the latest post

 *  Resolved [sketchee](https://wordpress.org/support/users/sketchee/)
 * (@sketchee)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/)
 * I want to embed just the latest post from my wp blog (sketchee.com/wp) on the
   bottom of my main page. I couldn’t figure out how I could do this. Is there a
   way just to generate an include file that I can use a server side incude to put
   the file into the html (not php) front page?

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

 *  [tsguitar](https://wordpress.org/support/users/tsguitar/)
 * (@tsguitar)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434106)
 * If you are going to include WordPress content on a page, it must be a PHP page(
   end with a .php or .phtml). The entire page could be static HTML, just give it
   a .php or .phtml extension.
 * Any page that is outside the WP installation can still have WP stuff on it. Just
   add this to the top of the page:
 * `<?php require('pathtoyourwordpressinstall/wp-config.php'); ?>`
 * Check this out:
    [http://wordpress.org/support/topic/82371?replies=20#post-423153](http://wordpress.org/support/topic/82371?replies=20#post-423153)
 * So, if you put that little bit of code at the top of the page, this should work
   to display the most recent post:
    ` <?php $posts = get_posts('numberposts=1');
   foreach($posts as $post) : setup_postdata($post); ?> <a href="<?php the_permalink();?
   >" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a> <?php the_content();?
   > <?php endforeach; ?>
 * Here’s more information:
    [http://codex.wordpress.org/Template_Tags/get_posts](http://codex.wordpress.org/Template_Tags/get_posts)
 *  [tsguitar](https://wordpress.org/support/users/tsguitar/)
 * (@tsguitar)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434343)
 * Not `wp-config`. Use this instead:
    `<?php require('./path-to-your-blog/wp-blog-
   header.php'); ?>`
 *  Thread Starter [sketchee](https://wordpress.org/support/users/sketchee/)
 * (@sketchee)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434387)
 * I’ll give it a try when I get home this evening. Let you know how it goes! Thanks
 *  Thread Starter [sketchee](https://wordpress.org/support/users/sketchee/)
 * (@sketchee)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434399)
 * Worked great: [http://www.sketchee.com](http://www.sketchee.com) Thanks
 *  [danmoriarty](https://wordpress.org/support/users/danmoriarty/)
 * (@danmoriarty)
 * [19 years, 8 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434439)
 * Thanks, keep this around, Very helpful.
 *  [Seaborn](https://wordpress.org/support/users/joyhog/)
 * (@joyhog)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434446)
 * This code isnt working for me, am I doing something wrong. Im using the Static
   Front Page plugin and editing the “HTML” of home.php.
 *  [Seaborn](https://wordpress.org/support/users/joyhog/)
 * (@joyhog)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434447)
 * Could this just not work in 2.0.4?
 *  [carl_in_florida](https://wordpress.org/support/users/carl_in_florida/)
 * (@carl_in_florida)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434501)
 * When I try this I get
 * WordPress
 * Can’t select database
 * We were able to connect to the database server (which means your username and
   password is okay) but not able to select the christia_wrdp1 database.
 * Any ideas? The blog works just fine.

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

The topic ‘Embed only the latest post’ is closed to new replies.

## Tags

 * [embed](https://wordpress.org/support/topic-tag/embed/)
 * [ssi](https://wordpress.org/support/topic-tag/ssi/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [carl_in_florida](https://wordpress.org/support/users/carl_in_florida/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/embed-only-the-latest-post/#post-434501)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
