The Internet Explorer beta has been out for a month or so now, and Microsoft is preparing to release the official version. I downloaded and installed it earlier this week, and overall it is good. Not good enough to move me off Firefox, but a must-update for any IE7 user. And there’ still a significant number of you out there — no longer a majority, but still a lot. One of the new features is a SLICE – similar to the Firefox Live Bookmarks or an RSS feed. So I decided to see how this would be implemented in a WordPress blog.
The code below is almost directly from an excellent post on Digital Inspiration — with some tweaks to automate some of the hard coded stuff like blog title that they had on their code examples.
The first thing to do is create a file called slice.php and put it in your main blog directory (where config.php lives.):
<?php require(‘./wp-load.php’ ); ?>
<html><head>
<title><?php bloginfo(‘name’); ?> Latest News</title>
</head><body>
<div class=”hslice” id=”latest_news”>
<h2 class=”entry-title”><?php bloginfo(‘name’); ?></h2>
<div class=”entry-content”><ol>
<?php
$results = $wpdb->get_results(“SELECT post_title, guid
FROM $wpdb->posts where post_status = ‘publish’
ORDER BY ID DESC LIMIT 5″);
foreach($results as $row) {
echo “<li><a href=’”.$row->guid . “‘>”
. $row->post_title .”</a></li> \n”;
}
?>
</ol></div></div>
</body></html>
This will display the five most recent posts in a numbered list. Now that you have the slice, you need some code on your main WordPress page to link to it. Put this in your sidebar, or wherever you want the slice to appear. In fact you probably want to wrap this text around the title for wherever you list the latest posts. In my blog that is the Stay Informed! link, but in the code below I titled it Recent Posts, which is a common section in many WordPress templates:
<div id=”latest-posts” class=”hslice”>
<h3 class=”entry-title”>Recent Posts</h3>
<a style=”display: none;” rel=”feedurl” href=”<?php echo get_bloginfo(‘url’);?>/slice.php”></a></div>
If you run my site through IE8 you’ll see how this works. To further develop on this idea is would be great to create a plugin to make this configuration easier. I’d also like to have it automatically create slices for each of the category links. With the plug-in you wouldn’t need the slice.php file, you’d set the plug-in to generate that dynamically.
Coding-wise this shouldn’t be too complex a task. The real question is whether it is worth the effort. With IE’s rapid drop from dominance down to under 50% browser share, is it really worth spending time on IE-only site features? As a learning excercise maybe — as a technical strategy for a real site, probably not. Better to spend your time on features aimed at mobile devices.
Tutorial: How to Write an IE8 Web Slice for WordPress Blogs
If you have a WordPress (self-hosted) blog, here’s how you can create a web slice that IE 8 users can add to their menu bars.
Subscribing to Content with Web Slices – MSDN
WebSlices are an exciting new technology in Internet Explorer 8. WebSlices work like RSS feeds; you simply go to sites that are enabled for WebSlices, like eBay or Facebook. Simply click on the WebSlice button and add it to your favorites bar.

ADD YOUR COMMENT
Comments are moderated.
Randall Rode's online home for thoughts, notes, and experiments with a wide range of technology topics. Visit the about page for info on my recent projects and professional background. I welcome your comments!
New articles are normally posted on Mondays and Wednesdays. Subscribe to the RSS feed or the email update to keep current on the latest posts.