When I used Movable Type for my blog, I had made a template that just included information from my most recent post. I then included the resulting static page on the front page of my main website.
I was updating that site today … I replaced the Guestbook I had there with the ShoutOut script that I wrote. I realized that I still had the exerpt from my MT blog on my main page. I wanted to replace this with the most recent post from this blog (since I’m no longer updating the other one). A plugin wouldn’t work … I’m not putting this on a page inside of my WP install. So … I wrote a script that I put in the root directory of my WP install. I then called that from my front page, and wallah … there it was. It was easy to do, but took a bit of tweaking to get the number of comments to show up correctly. You can see how it looks here.
Anyways, I thought I would put the code here in case anyone else wanted to do the same thing. I’m not sure if they do. Or if there’s something already written for WP that does this (I didn’t search for it ‘cuz I wanted to write it myself ‘cuz I knew I could …
).
If you would like this code, you can get it here (upload it to your main WP install directory). You’ll need to fill in a couple of variables (the URL to your WP install, the server path to your WP install, and the number of characters from the post that you want to display). They’re at the top of the script and are commented with instructions. To use the script on your outside website, use a simple include …
<?php include '/path/to/wp/install/wp-exerpt.php'; ?>
Simple as that. If you end up using this, let me know. Once again, I’m curious to see if anyone wants this functionality other than me. Maybe it’s just ‘cuz I’ve got so many subdomains (I believe I’ve got 8 subdomains in addition to my main domain). And as I’ve said with my plugins … if you do use this and run into any problems, please let me know so I can troubleshoot.