I was wondering how to add my latest post to an html page. ex. http://www.davidgarrett.org/blog is my WordPress blog, but what code would I add to http://www.davidgarrett.org/index.html to display my latest post?
I was wondering how to add my latest post to an html page. ex. http://www.davidgarrett.org/blog is my WordPress blog, but what code would I add to http://www.davidgarrett.org/index.html to display my latest post?
If you do a search using the field in the upper right corner of the page, you'll find a whole slew of posts relating to this setup. They'll discuss using The Loop and CG-Feedread, and perhaps a couple of other options.
I am not sure any of those solutions will work with an html page...
*shrug* No - but then some of them address the fact that the index page has to have a php extension - and really, regardless what it's named, it's still just markup....
OK, I couldn't go to sleep before checking this out :)
Searched Google for "feeds in html files" and it found several free scripts that would convert the rss feed of your blog into html to display on your webpage.
Nohaber's solution of creating a minimal .php page in the blog sub-directory then using a SSI to display it on the .html page works well for me:
http://forums.digitalpoint.com/showthread.php?t=35777
I wanted to do the same thing so I created an iframe in my html file -
<iframe src="headlines.php" name="blog" width="170" scrolling="no" frameborder="0" ><a href="http://www.yourdomain.com/headlines.php" title="whatever u want"></a></iframe>
Then created a php page, added the following code and titled it 'headlines.php'
<?phpID
$how_many=4; //How many posts do you want to show
require_once("wordpress/wp-config.php"); // Change this for your path to wp-config.php file ?>
<?
$news=$wpdb->get_results("SELECT ,post_title FROM $wpdb->postspost_status
WHERE = \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
foreach($news as $np){
printf ("
<li><a>%s</a></li>
", $np->ID,$np->post_title);
}?>
This topic has been closed to new replies.