Finding An Alternative to Feedburner’s BuzzBoost
August 29th, 2007 in web development | 2 Comments
When redesigning my homepage, I knew I wanted to have a list of my most recent blog posts. I looked around and found Feedburner’s BuzzBoost, which allows you to republish your feed as HTML. Since I was already using Feedburner, I thought that was the easiest solution. Unfortunately, it wasn’t the fastest. To implement it, I had to copy and paste some javascript which output the HTML using document.write(). The loading time of the script visibly affected my page, giving it a broken look while the script loaded. And it wasn’t even anything spectacular; I was just displaying the three most recent posts. Thus, I set out on my own to find a better solution.
My first idea was to cache the results of the javascript, but I soon discovered that it was impossible. PHP doesn’t render javascript. I could have whipped up some ajax that wrote the results to a file, but that just seemed like a huge workaround for something so simple. In the end, I decided to write a WordPress plugin that saved the most recent entries to a file after a post has been published, and I just included that file in my homepage.
Here’s what I came up with:
function recent_posts_list() { $r = new WP_Query("showposts=3&what_to_show=posts&nopaging=0"); if ($r->have_posts()) { $content = '<ul>'; while ($r->have_posts()) { $r->the_post(); $content .= '<li><a href="' . get_permalink() . '">'; if ( get_the_title() ) $content .= the_title('', '', false); else $content .= the_ID('', '', false); $content .= '</a><p class="date">' . the_date('l, F j, Y', '', '', false) . '</p></li>'; } $content .= '</ul>'; file_put_contents('../recent_posts.html', $content); } } add_action('publish_post', 'recent_posts_list'); add_action('activate_recent_posts_list.php', 'recent_posts_list');
Essentially, all I did was copy the code from the recent entries widget and adapted that, making sure to pass in false to all the functions that produce output, otherwise it would just be echoed. Then I wrote that to a file. In order for my plugin to do anything, I had to add actions to WordPress hooks. I added the bare minimum. If you choose to do this and frequently delete posts or edit post titles, you may want to add actions to those hooks.
And that’s it. To get the list to show up in my homepage, I just include()ed the generated file. It was a nice learning experience. Hopefully you can get something from it.

