Tag Archives: wordpress

Creating a Shortcode for the Organize Series WordPress Plugin

Insert this code into your WordPress functions.php file (or custom_functions.php if you’re using Thesis like I am) to enable a quick way to display a series of articles created with the Organize Series plugin.

function get_thumb_series( $atts ) {
	extract( shortcode_atts( array(
		'ser_id' => false
	), $atts ) );
	if ('ser_id' == false){
		return false;
 	global $post, $orgseries;
	$series_post = array();
	$posts_in_series = array();
	$settings = $orgseries->settings;
	$ser = $atts['ser_id'];
	$result = '<div class="episode-list">';
		$series_post = get_objects_in_term($ser, 'series'); 
		$posts_in_series = get_series_order($series_post, 0, $ser, FALSE);
		foreach($posts_in_series as $seriespost) { 
				$result .= token_replace(stripslashes($settings['series_post_list_post_template']), 'other', $seriespost['id'], $ser_ID);
		$result .= '</div>';
		return $result;
add_shortcode( 'get-ts', 'get_thumb_series' );


On any post or page (and possibly anywhere else) where you want to list a particular series, enter the following shortcode:

[get-ts ser_id='n']

where n is the ID of the series you want to display (you can find this in the Manage Series admin page).

So, for instance, if you want to display a list of posts contained in a series with ID=10, you’d enter the following in the text of the post or page:

[get-ts ser_id='10']

Why and How did I do this

I’m using the wonderful Organize Series plugin on a site I’m working on to display hundreds of TV episodes together in a logical arrangement. As part of my CMS strategy, I needed a way to display the content of a series on a page that is not a part of the series.

Suppose you have all the episodes of “The Big Bang Theory” organized in a series so that you can jump from one to the next in a logical order and not be constrained by a blog’s chronological ordering system. If you want to create a page with additional info about the show, there’s no clear way to add the episode list to the page. This Shortcode will allow you to do just that.

The Organize Series plugin includes a file filled with useful functions (orgSeries-template-tags.php in the plugin’s folder). Figuring out how to put all that info to good use was a bit harder, since Organize Series now keeps all their support forums behind a pay-wall. The Internet Archive’s Wayback Machine solved that by letting me look at some older pages from back when the support forums where open.

Further help came from Aaron Jorbin’s post on WordPress Shortcodes – A how to by example.

The nice thing about this Shortcode is that you can edit the output to suit your needs. The reason I called the function get_thumb_series is that I originally wanted to generate a list of episodes with a thumbnail next to each one. I still haven’t done that, but there’s nothing keeping you from changing the function to return whatever it is you need. I’m currently using the default functions within orgSeries-template-tags.php (and the function itself is an abridged version of get_series_posts()), but will eventually add my own to return just the information I need about every episode (thumbnails, air dates, duration, etc).

I’ll add links to example pages once the site goes live. In the meantime, let me know if this article was helpful to you and feel free to post any fixes or updates.

We’re moving up!

This blog’s web address will be moving up from http://red66.com/blog to simply http://red66.com.

All links and articles should automatically send you to the new address, but keep in mind that some pipes might break during the move. If at all possible, please change any bookmarks or links you have to reflect this change.

In addition to this change of address, I’ll be upgrading the blog’s WordPress version to 2.3.

If you find anything is broken, let me know via the comments below.

New Look

Well, finally… the blog has a new look. Everything seems to be working, but do let me know if you find any gremlins. The original theme (Subtle, with Subvert style) comes from Glued Ideas, but needed a lot of customizing to get some things working. I installed a local copy of WordPress on my MBP and replicated my blog with the help of several articles I found online and lots of elbow grease. Upgraded the server to PHP5 and WordPress 2.05. Some minor cosmetic details will be taken care of shortly, but meanwhile I hope you enjoy the new look and functionality.