Blog Exerpt
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.
lonely
Your new employers sure made the right choice. You’re so good at this web design stuff!
I hope they made the right choice … LOL I’m afraid that I’m going to get in over my head. But I do seem to learn these concepts fairly quickly. I should be okay.
This script is a great idea!! Can I make a request (not sure if it’s possible…) I’d LOVE it if instead of pulling in the content as dynamic - if it WROTE IT TO A FILE - (maybe on post update/add etc.- look at the plugin hooks). As it stands now - you couldn’t include that on a page that’s already powered by wordpress… Personally, that’s what I need - since I include snippets from two other blogs on my main one (the other two are still MT powered) If I want to move those two to WP also - I’ll need a way to include the snippets…
Don’t know if that makes sense - or if you’re even interested in furthering development of this…
Jen - It does make sense. However, I’m not sure that it’s something that I know how to do. I’m sure I could figure it out, but I’m not sure when I’ll be able to work on it. I can see what I can do tomorrow. But Wednesday, I’ll be starting work (providing the computer gets there and is set up). I’ll look into it, but I can’t give a timeline as to when I’ll get something that works. If it’s something you really want and you think you’d be able to do it before I could, feel free to use what I’ve got as a starting point if it would be of any use. Otherwise I’ll work on it when I have the time.