Publish RSS feeds on your WordPress site without plugins

Wednesday, February 13th, 2008

Darren Hoyt, that brilliant WordPress developer and designer, explains how you can publish RSS feed headlines on your WordPress blog with a built-in WordPress function instead of using a plugin.

As Darren says, this code snippet is not intended for scrapers; it’s for people who have more than one blog, or are part of a blogging network, and would like to have their readers exposed to their other blog material.

The necessary code is what pulls all the Planet WordPress feeds into your WordPress dashboard. Darren took that code from wp-admin/index-extra.php and rewrote it into a snippet which you can insert into your theme files:

<?php

require_once (ABSPATH . WPINC . '/rss-functions.php');

// here's where to insert the feed address

$rss = @fetch_rss('http://www.darrensmusicnews.com/feed/');

if ( isset($rss->items) && 0 != count($rss->items) ) {

?>

<ul>

<?php

// here's (5) where to set the number of headlines

$rss->items = array_slice($rss->items, 0, 5);

foreach ($rss->items as $item ) {

?>

<li>

<a href='<?php echo wp_filter_kses($item['link']); ?>'>

<?php echo wp_specialchars($item['title']); ?>

</a>

</li>

<?php } ?>

</ul>

<?php } ?>

Obviously, you have to change the feed address on the fourth line to yours. You can also select how many items from the feed should appear.

In the comments, Darren says that you can publish multiple lists of feeds by copying the snippet with several different RSS feeds. If you want to aggregate a bunch of feeds into one single feed that you’ll republish on your blog, he recommends the Easy Blog Networking for WordPress Blogs plugin, which combines a bunch of feeds and republishes them in one list, or Yahoo Pipes.

Another Option from the WordPress Codex 

Scot Hacker brings another variation for displaying RSS feeds on a site: the WordPress function fetch_rss. On the WordPress Codex, you can see an example for displaying a list of links for an existing RSS feed, limiting the selection to the most recent 5 items:

<h2><?php _e('Headlines from AP News'); ?></h2>
<?php // Get RSS Feed(s)
include_once(ABSPATH WPINC '/rss.php');
$rss fetch_rss('http://example.com/rss/feed/goes/here');
$maxitems 5;
$items array_slice($rss->items0$maxitems);
?>

<ul>
<?php if (empty($items)) echo '<li>No items</li>';
else
foreach ( 
$items as $item ) : ?>
<li><a href='<?php echo $item['link']; ?>'
title='<?php echo $item['title']; ?>'>
<?php echo $item['title']; ?>
</a></li>
<?php endforeach; ?>
</ul>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Hell Yeah Dude’s list of ways to supplement your WordPress content

Thursday, January 10th, 2008

Hell Yeah Dude has a great rundown of different types of content you can add to your WordPress blog, and plugins for doing so: flickr, Twitter, Pownce, Tumblr, de.licio.us and more.

12 automatic ways to increase the content on your WordPress powered Web site » Hell Yeah Dude! – A Web site for young & inspiring minds

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Surfing the blogosphere is just like, oh I don’t know, detecting contaminants in water

Tuesday, October 30th, 2007

Some crazy academics have written a very academic paper (PDF) on how you can use the same system to figure out where to put sensors in the water to detect contaminants, and make sure we catch all the good stories in the blogosphere. Oh goody!

Basically, all you have to do is exploit submodularity to develop an efficient algorithm that scales to large problems, achieving near optimal placements, while being 700 times faster than a simple greedy algorithm [we hate greedy algorithms]. Also, you need to derive online bounds on the quality of the placements obtained by any algorithm. Their algorithms and bounds also handle cases here nodes (sensor locations, blogs) have different costs.

Or, you could just subscribe to TechCrunch, BoingBoing, Read/WriteWeb, and Seth Godin’s Blog. I’ll have to think about. All that algorithm stuff is so tempting.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

New Answers.com WordPress plugin creates quick links to definitions

Friday, October 12th, 2007

Answers.com

Answers.com is a free online service that provides definitions and encyclopedic-entries on millions of topics. (It is also an Israeli company – I had to add that :) ). The company has now partnered with Automattic, the guys behind WordPress, with a new plugin for self-hosted WordPress blogs, and with an integrated service on WordPress.com blogs.

The plugin will add a button to the toolbar that, when clicked, creates an automatic link from a word to its entry on Answers.com. Here’s the explanation from the press release:

To use the new feature, WordPress.com bloggers will press the AnswerLinks(TM) icon (http://www.answers.com/main/wordpress_howto.jsp) on the WordPress editing toolbar to trigger an application that will suggest terms for automatic linking. Typical suggestions will include names, technical terms or obscure language that may not be familiar to some readers. Only words confirmed by the author will be linked to definitions, assuring full editorial control.

I can see how this could be useful; often when I’m writing about topics that I know many people aren’t familiar with, I’ll link key words to their entry on Wikipedia. This may be a faster way to provide that type of helpful information to users.

This is also a nice development for Answers.com, who recently bought dictionary.com for a bazillion dollars in cash (ok, it’s more like $100 million, which in my world is a bazillion), a move whose wisdom was questioned by many. I don’t know if this new partnership will spell success for Answers, but it’s a move in what seems to be the right direction.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

The secret to a successful blog: writing good content

Thursday, April 12th, 2007

Ramit over at I Will Teach You To Be Rich reminds us that when all is said and done, a blog’s success depends on the merit of its content, and not on the quality of its design, stats programs, or all the SEO stuff you do to optimize your site. These things help, but they won’t make or break it for you.

I hate bloggers who waste their time on stats>>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Premium News Themes