Many people have asked me how I embedded the available Lifestream plugins (or code) so that it looks like mine at h4x3d.com/lifestream
Many seem to struggle with the (yet) simple set-up or use the wrong (and buggy) files.
Since the Lifestream I use is a mixture of different Lifestream plugins and it is all open-source, I would like to lift some secrets and share my knowledge with you.
My resources include Jeremy Keith‘s Lifestream plugin code (at the bottom), Elliot Back‘s Lifestream code (that did not work correctly), this article, a blog dedicated to Lifestreams and last but not least Gunnar Þór Hafdal – the Lifestream godfather. I was lucky to pick-up his code. I removed some items here and there, but in general he did 99,9% of the work, thank you!. I wonder why he took down his Lifestream and the code samples? They were great.
Below you will find the code, please note that the WordPress Plugin integration does not work, you will have to hand-code the variables such as FlickrRSS etc in the life.php itself.
NOTE: You need to run a quick CTRL+H (find and replace) for the < ?php… the code-markup on this page is that way so it does not break anything. You need to finalize the script yourself by changing all instances of < ?php back to the original (delete the blank space)
Life.php (goes in Theme folder)
'http://feeds.feedburner.com/Twitter/h4x3d',
'life_blog' => 'http://feeds.feedburner.com/jez',
'life_flickr' => 'http://api.flickr.com/services/feeds/photos_public.gne?id=29642584@N00&format=rss_200',
'life_delicious' => 'http://feeds.feedburner.com/Delicious/h4x3d?format=xml',
'life_lastfm' => 'http://ws.audioscrobbler.com/1.0/user/h4x3d/recenttracks.rss',
'life_digg' => 'http://digg.com/rss/jizz/index2.xml',
'life_cocomment' => 'http://www.cocomment.com/myrss2/jez.rss'
);
}
function checkStreams() {
if( get_option( 'life_installed' ) ) {
} else {
self::install();
}
}
function install() {
add_option( 'life_installed', '1', "" );
add_option( 'life_version', '1.0', "");
foreach ( self::defaultStreams() as $key => $value ) {
add_option( $key, $value, "" );
}
/* echo 'Installed, ready to go.' */;
}
function upgrade() {
foreach ( self::defaultStreams() as $key => $value ) {
if( !get_option( $key ) ) {
add_option( $key, $value, "" );
echo 'Added ' . $key;
}
}
}
function loadStreams() {
foreach( self::defaultStreams() as $key => $value ) {
// find the values for each of our streams (RSS Feeds)
if( get_option( $value ) ) {
$value = get_option( $value );
} else {
echo '
' . $key . ': ' . $value . ' not found in the database.
';
}
}
}
}
life::checkStreams();
?>
Another file
Stream.php (goes in Theme folder)
(legend of tags)
<a href="" rel="bookmark" title="Permanent Link to ">
< ?php the_content('
Continue reading this article'); ?>
$feed ) {
$rss = @fetch_rss( $feed );
$items = $rss->items = array_slice( $rss->items, 0 );
foreach ($items as $item ) {
$date = strtotime( substr( $item['pubdate'], 0, 25 ) );
// This fixes the time error that the "date_default_timezone_set" should fix
// Set it as $date += 3600*1; to add 1 hour or $date -= 3600*1; to remove 1 hour
// I think it's based around the UTC time
$date += 3600*2;
$list[ $date ][ "name" ] = $name;
foreach ($details as $detail) {
$list[$date]['title'] = $item['title'];
$list[$date]['link'] = $item['link'];
}
}
}
krsort( $list );
$day = '';
foreach ( $list as $timestamp => $item ) {
$this_day = date("F jS",$timestamp );
if ( $day != $this_day ) {
?>
<tr class="vevent ">
<img src="" alt="" />
<abbr title="">
(special code goes here, see below)*
Sorry, no posts matched your criteria.
*Special code, it breaks the display, type it down yourself in order to make it work. Don’t be lazy :)
1 <a class=”url summary” href=”< ?php echo $item["link"]; ?>”>< ?php echo $item["title"]; ?></a>