简体   繁体   中英

show recent wordpress post on static html page

I have a site that is done in HTML/PHP, mostly using static .html files.

I added a blog, and would like to grab the posts from it to display in the sidebar of the homepage.

I've followed this guide to do so.

The problem is its not working, and I'm not 100% certain if the correct wordpress file is being pointed to.

The blog is kept in a directory called wordpress. So my statement looks like this: require('wordpress/wp-blog-header.php');

Is there something wrong with this? Is there a way to check using chrome if the file has been found / loaded?

Thanks

If you intend on sticking solely to static HTML pages, the tutorial you mentioned will not help you. Your only option here is to fetch your blog posts from an RSS feed or a JSON feed using JavaScript. I would go for the latter since it's easier to deal with (especially if you utilise jQuery).

Here's a few things for you to check out or read up on:

http://wordpress.org/extend/plugins/json-api/

http://api.jquery.com/jQuery.getJSON/

Parse RSS with jQuery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM