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' );
Usage
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.
Let's Connect
If you want to hire me or get in touch about something or just to say hi, reach out on social media or send me an email.
Other blogs
Some other blogs where I've posted throughout the years. Most of these will eventually migrate here.