Fun With WordPress Theme Toolkit

I came across WordPress Theme Toolkit while developing my current theme; Tuned… and I thought, what the heck, I might as well give it a whirl.

I’d like to share one of the things I use the toolkit for: Automatically Generating Feeds Links. To implement this project on your WordPress powered blog, you’ll need the feedList plugin, and WordPress Theme Toolkit (of course).

Setting up these plugins are not in the scope of this mini tutorial. If you have problems doing that, then I guess this tutorial is really not for you, yet. No that that’s out of the way… let’s get cracking!

Getting Input

First off, we need some way to get some input to start displaying the feeds. At the very least, feedList needs the feed URL to work. Other info you’ll need to generate a well-structured feeds list are as follows:

  1. A descriptive title for the feed.
  2. URL of the site you’re syndicating from.
  3. How many items do you want to display.

Now, let’s get this project up and running. Create a textarea in your theme’s functions.php where we will enter the items above (refer here for instructions). Mine looks something like this:

'feedslist' => 'Feeds List {textarea|6|50} ## Format: Site Name, http://site.url, http://feed.url, Limit',

As you can see from my example, I want to enter the data in a comma-separated list.

Data Entry

Once you have successfully created the input section, it’s time to populate the textarea. The format you should use is as follows:

Site Name, Site URL (must be full URL, with http://), Feed URL (must be full URL, with http://), Limit (How many items to show, must be an integer)

Each entry must be on one line (input line, not the wrapped line, meaning, don’t press Enter before keying in the limit).

My set of lists looks like this:

LQ Slackware Forum,,, 5
Kernel Releases,,, 10
Recent Diggs,,,5
My Diggs,,,5

Actually Doing Something with the Data

We’ve created the textarea for input and we’ve actually populated it with data. Now let’s turn that data into something useful… you know like, actually generating the feeds!

Now, this requires a little bit of PHP programming. We need to write a function that will automatically output the feeds list on our web page(s). This function should be created near the end of your functions.php, right before the PHP close tag ( ?> ). Fortunately for non-coders, I have already created the function for you to use:

function getfeeds() {
global $mytheme;
$variable = trim($mytheme->option['feedslist']);
$array = explode("\r\n", $variable);
$subarray = array();
foreach ($array as $value) {
$subarray[] = explode(",", $value);
foreach ($subarray as $key => $val) {
$val[0] = trim($val[0]);
$val[1] = trim($val[1]);
$val[2] = trim($val[2]);
$val[3] = trim($val[3]);
$val[0] = str_replace("&", "&", $val[0]);
$val[1] = str_replace("&", "&", $val[1]);
echo "<li><h2><a href='".$val[1]."'>".$val[0]."</a></h2>\n";
echo "<ul>\n";
rssLinkList($val[2], $val[3], false);
echo "\n</ul>\n</li>\n";

Note that the variable $mytheme that I globalised in the function may not be the same as what you’re using. $mytheme is the default name used in WordPress Theme Toolkit, you should definitely change this to your own variable name.

What this function does is to output your feeds in an unordered list. This function will produce HTML compliant codes when placed between <ol> or <ul> tags (commonly used in WP themes’ sidebars).


All you need to do to get your feeds list to be displayed is to call the getfeeds(); function where you want it to be displayed.

I called it in my theme’s sidebar.php. You can output your list anywhere in your theme, but remember to enclose it between <ol> or <ul> tags. You may need to modify the function a bit if you want to add extra stuff like CSS.


The function will definitely break if the site’s feed URL or home page URL contains commas. You might want to use a different separator character if this is the case. You should also modify the getfeeds function accordingly to reflect this.

8 responses to “Fun With WordPress Theme Toolkit”.

  1. Ozh Says:

    Hey ! That’s a cool hack 🙂

  2. planetOzh Says:

    Hacking WordPress Theme Toolkit

    Interesting hack of my plugin

  3. Sally Says:

    I wonder since you mentioned what you did if you know how to make this work for me…Great blog here. have a nice weekend! Sally

  4. Linking-serivce Says:

    nice hack man. keep it up.

  5. David Kitchen Says:

    Great tutorial. This worked a treat.

  6. Mike Says:

    I would like to see some good info on a couple of things – 1 is where to syndicate from, a list of good interesting feeds organized by theme/content, 2 how to syndicate from another blog. I really enjoy some of the postings by bob parsons – the guy who founded godaddy, i find he has some very interesting things to say relating business lessons to real life – but how to syndicate his content? thoughts?


  7. cari duit Says:

    thanks for inviting me to your site. i already bookmarked this page.

  8. One Way Links Says:

    thanks for the nice trick..