About Anthony
Anthony Cimaglia has written 11 post in this blog.
Anthony is a local internet marketer that works with Long Island business owners to increase their bottom line utilizing web design and the power of search engines. We work directly with small business owners to increase their companies online visibility through search engine optimization and social media management. Experts at our Long Island Web Design firm know the difference between advertising effectively or just wasting time. Visit my Google + page for more information.
As WordPress blogs become more popular, the need for a static sites and wordpress to interact is more important than ever. I hunted the internet for a few minutes and decided to write this post because it was hard to find any solution. I was able to finally find the solution on how to include the latest post onto my static html website. It’s a two part process and it is simple as long as your wordpress blog is on the same website FTP so you can include files from other directories on your main site. If you understand an include statement or even copy and paste then you should be fine.
Just put this code snippet in wherever you want the top 10 listings to show on your website. Have an area dedicated for it. Usually a table cellor a
that can grow longer or shrink will work fine.
<div>
<?
include('./blog/wp-load.php');
get_archives('postbypost', '10', 'custom', '<li>', '</li>'); ?>
</div>
That will display just the loop of the latest 10 articles. You can then add a heading and styles to it to make it look better.
I also want to go over the Include line above ex:
include('./blog/wp-load.php');
That is tricky situation depending on where your static site is or if it is in a subdirectory.
You might even name the blog directory something different than that. You need to just make sure that that include statement points to the file so you get that functionality you need.
Hope that this helps out. I knew I needed help with how to Include Latest Posts into my HTML Code using a PHP Static Site. If you need any help feel free to reach out to us. We might be able to help you with this or other WordPress problems. Trust the experts at Long Island Web Design for any of your website needs.
How do you rate this?