Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Wordpress blog injection

This is the thing. I am building a site and I want just the most 3-5 recent post shown on the home page. The rest of the site was not built on the WP platform. How do I approach this

Andrew Shook
Andrew Shook
31,709 Points

So your home page is a static html page and not a part of wordpress?

2 Answers

Andrew Rowberry
Andrew Rowberry
3,579 Points

you need to download wordpress onto your root directory then use a php include to the wp folder on your index.php thats outside the wp folder in your root dirrctory, next put the basic wordpress loop where you want the posts to be displayed.

Andrew Rowberry
Andrew Rowberry
3,579 Points

include wp onto your index.php like this <?php require 'yourwpfolder/wp-blog-header.php' ?>

Thank you very much Andrew!