Plugin: In-Series feed icon

WordPress categories are great for grouping posts of a similar nature together, but creating a new (sub-)category every time you have a series of posts can be tedious. Sometimes you might not have enough posts in the series to justify a whole new category. Or perhaps each post in the series belongs in seperate categories. Various plugins exist to link posts together by various criteria; but no elegant solution existed to definitively link sequential posts in a series, regardless of when they were posted, or to which categories they belong. Until now!

In-Series provides an easy, future-proof way to connect a series of posts. If you have a series of articles on your site, and you want to ensure your readers can follow the sequence within the series, In-Series will help you provide the links between the posts and articles, improving your site's navigation.

The plugin creates three new template tags available for use in your theme's single.php:

previous_in_series()
displays a link to the previous post in the series, if there is one. If the current post is the first post in the series, this template tag will not display anything.

next_in_series()
displays a link to the next post in the series, if there is one. If the current post is the last post in the series, this template tag will not display anything.

all_in_series()
displays a list of links to each post in the series. The current post is not linked, to ensure the reader knows where in the series they are.

series_table_of_contents()
displays a clickable link for each post's title as an ordered list(<ol><li>...</li></ol>)

Then simply apply two new custom fields to the posts in your series:

series_name
a unique name for the series

series_order
the current post's position in the series

Examples are provided in the in-series.txt included in the zip file.

UPDATE: Thanks to Lorelle for spotting an error with sorting long tables of contents; and to ColdForged and necrotic for their help pointing me toward the solution. Version 1.2 is now available.
UPDATE: Thanks to Lorelle for the suggestion to make a table of contents! Version 1.1 includes the new function series_table_of_contents().
UPDATE: Thanks to Monika for alerting me to an error in series_table_of_contents. This is fixed, and version 1.3 is now available for download.
UPDATE: Version 1.4 is now available for download. It fixes a flaw in the sorting of posts in a series.
UPDATE: Version 1.5 is now available. Thanks to io_error for pointing out that previous versions incorrectly included draft posts in the series. Also added $before and $after to series_table_of_contents().
UPDATE: Version 1.6 is now available. Thanks again to io_error for pointing out that static pages were excluded from series. You can now construct a series composed of posts and pages.

Download In-Series 1.6!


  • May 27th, 2005
  • Lorelle
    This is so cool. I adore this plugin. It makes connecting articles so easy. Thank. I've been waiting for something like this for a very long time.
  • Jax
    The download link is broken!:-(
  • skippy
    Jax: thanks for the heads-up. The link is corrected, and the download should work now.
  • May 27th, 2005
  • Shawn Grimes
    This should come in quite handy for Chris J. Davis and his new Template series of articles. I'll keep this on file for future use for sure. Thanks for you time and effort skippy.
  • May 28th, 2005
  • kalli
    A very good and useful tool! Thank you! a link in all_in_series(’,', “$series_name: “, ‘’) to show all complete entries in the series if one clicks on $series_name like the search function would be fine.
  • May 29th, 2005
  • Richard Silverstein
    I'm delighted that In-Series does something I've longed to see for over 2 yrs.! But I have a problem. I'm not great with coding & don't understand exactly what this means in the instructions & how to do it:
    Modify your single.php (http://codex.wordpress.org/Template_Hierarchy#Single_Post_Page) template to call any of the following functions: * previous_in_series() * next_in_series() * all_in_series() * series_table_of_contents()
    Can you or someone help decipher this for me?
  • skippy
    Richard: In-Series provides you with a few new template tags. See Stepping into Template Tags for a quick tutorial on how to use template tags to modify the layout and presentation of your site. If you still have questions, don't hesitate to ask!
  • Richard Silverstein
    In all honesty, your previous reply didn't help much though knowing about template tags is I'm sure an important thing if you're going to be using WP. I needed help translating your phrase in the installation instructions "call" into plain English & css code. Luckily, a forum member did that. I'd suggest for technical non proficient's like me you might consider changing that part of yr. directions so they display this code instead of telling you to "call": I then installed the in_series.php file into my plugins directory and modified the single.php file as suggested. Here's what my file code looks like fr. the beginning up to the end of the In Series code. Maybe you can tell me if anything's wrong here: Trackback URL for this post: ">" rel="bookmark" title=" "> · Read the rest of this entry »')); ?> " rel="bookmark" title=" " class="permalink"> | " title="trackback" class="permalink">TrackBack Here are 2 posts which should be In Series (I filled out the key & value data as instructed & then published the posts. When I look at them I don't see any link indicating that they are in a series. I'd sure like to find out what I'm doing wrong: http://www.richardsilverstein.com/tikun_olam/2005/06/ken-schram-public-breastfeeding-is-like-urinating-in-public/ http://www.richardsilverstein.com/tikun_olam/2005/06/barbara-walters-stop-insulting-breastfeeding-moms/
  • Richard Silverstein
    I kept fiddling with the php code in the single.php file which IanD helped me with in the forum. And I finally got it to work. I am so damn delighted with both the plugin & technically unproficient me who got this thing working! You have no idea how sweet the feeling is to finally see a feature working in your blog which I've been calling for in vain & repeatedly when I was part of the Typepad community. Another reason that WP rocks & you do too for a beautiful plugin!
  • Mark J
    Cool idea! One thing that would be good is if you made series_order optional. It could be tedious trying to remember what the last number was, and it's an extra step. series_name gives you all the post IDs. Then so a SELECT on these posts and sort by post date. I would say that 95% of people will want series-type posts in chronological order. Unless you're George Lucas, how many times is part 4 written before part 3?
  • Monika
    Hi your plugin is wonderful-I love it, but I have a problem with it's html output I use: series_table_of_contents and if it is the page the /li tag is missing. here is the link to the validator and he shows my problem better than I could describe it.;) this page is the second of a serie http://validator.w3.org/check?uri=http://www.webdesign-in.de/index.php/mts/home-page-erstellen/ would you like to tell me how I could repair this in the .php ? thanks.
  • skippy
    Monika: Thanks for pointing out that bug! I've fixed it, and version 1.3 is now available for download.
  • Monika
    Oh! you are fast as the wind ... faster than a hurrican ;) http://validator.w3.org/check?uri=http://www.webdesign-in.de/index.php/mts/home-page-erstellen/ it looks pretty! I love this result everytime;) thanks a lot Monika
  • Mark
    Hi, This is a great plugin, thank you. But I found the series_order seems having problem. Say, I have 4 posts, their publish date is A->B->C->D, and I give series_order to be A(1),B(2),C(4),D(3). They should appear in A B D C order from all_in_series()/series_table_of_contents(), but not, they appear in A B C D order. Do I miss something? Or is it a problem?
  • skippy
    Mark: you discovered a minor bug in my logic. I have a corrected version, and was waiting on positive feedback from a tester before I release it. I'm fairly confident that my proposed fixes are valid, though, so I'll update the download links soon.
  • Mark
    Hi, You are really fast. It works now! Thank you.
  • June 19th, 2005
  • Mark
    Hello, Another question or suggestion: Can a post belong to 2 or more series? If yes, that would be quite useful.
  • skippy
    Mark: As it stands now, I honestly don't know what would happen if you try to make a single post in two series. Try it, and let me know! =)
  • IO ERROR
    OK, this is one sweet plugin. Thanks!
  • Fr, Daniel
    I've installed the plugin file, activated it, inserted into the single.php file. I created two posts and inserted the key fields and values. When I view one of the posts, no table of contents is displayed and I get the following error message at the bottom of the post: Fatal error: Call to undefined function: series_table_of_content() in /home/danielsp/public_html/blog/wp-content/themes/default/single.php on line 18 Any idea what might be causing this? Thanks for your help!
  • skippy
    Fr, Daniel: looks like you have a typo. The correct function call is series_table_of_contents(). Note the "s" at the end.
  • Jessica
    Hello! Originally I was coming here to report a bug with series_order values greater than 9. But then I noticed you had a newer version, so I downloaded and installed it, and it works great! :) Thank you so much for your time and effort with this excellent plugin.
  • Fr, Daniel
    Thanks, Skippy! I'm losing my vision, apparently.
  • June 26th, 2005
  • Sumeet
    Most importantly, great job on the plug-in. Thanks a lot for it. I do have a question. Is it possible to make it so only the user who began a certain series can add to that series? If I have many different users who don't know each other, the likelihood is high that they will type in the same series name unknowingly. I don't want their posts to become mixed. I know this isn't included in the plug-in, but I'm just wondering if you know of any code that might allow that. Thanks again.
  • skippy
    Sumeet: currently there is no provision to constrain series names, or restrict authors in how they assign names. If you have a lot of authors, you could try encouraging them to name their series with some portion of their account name. , like"skippy_series_1". Not perfect, but maybe good enough.
  • July 15th, 2005
  • Cilfa
    Your plugin looks really good, but unfortunately I can't get version 1.7 to work with Wordpress 1.5. This is the error I'm getting after clicking "Activate" in the plugins-screen: Fatal error: Cannot redeclare get_all_in_series() (previously declared in /data/websites/www.catbytes.org/www/wp-content/plugins/in-series-1.7/in-series.php:15) in /data/websites/www.catbytes.org/www/wp-content/plugins/in-series.php on line 15 What am I doing wrong?
  • Cilfa
    Ah, silly me: trying to install the plugin with two versions (I already had an older version installed apparently). But there's still a problem: WordPress database error: [You have an error in your SQL syntax near '(meta_value AS UNSIGNED) ASC' at line 1] SELECT post_id FROM wp_postmeta WHERE post_id IN (190,170) AND meta_key='series_order' ORDER BY CAST(meta_value AS UNSIGNED) ASC Warning: implode(): Bad arguments. in /data/websites/www.catbytes.org/www/wp-content/plugins/in-series.php on line 37 WordPress database error: [You have an error in your SQL syntax near ')' at line 1] SELECT ID, post_title FROM wp_posts WHERE ID IN () And I have assigned the two custom fields to two articles that are related. Must be another silly thing I'm overlooking, but I just don't see it.
  • August 18th, 2005
  • John
    If you have an apostrophe in the title of a post. It doesn't change it to an HTML character entity. In Wordpress, it autmatically changes the apostrophe into an HTML character entity automatically. I have not tested this with other characters like quotes or less than symbols which could possibly break the page. Thanks. :)
  • jon
    awesome plugin, just what i needed! two questions though: will it work for a series which does not begin with '1'? and also if my series order was not consecutive (3,5,6,7,9) etc? from what i see i think in both those cases it's still fine, but thought i'd ask. thanks!
  • skippy
    jon: your series can begin with any number, as long as the next item in the series is larger. If you want to number your series elements with 10, 20, 30, feel free. It should still work. Posts need not be consecutive in order to be in a series. in-series works independent of post ID or date. It uses only the series-order value you apply to each post to determine the order in which series posts are presented.
  • jon
    thanks for the response skippy -- and the great plugin :)
  • roge
    Thanl you for useful plugin. Just to note (you have type error in in-series.txt): Currently: php series_table_of_content() Should be: php series_table_of_contentS() Thanx again!
  • Charles Krause
    Excellent little plugin. Thank you very much for publishing it :) Just one question, do you think it would be useful to add a parameter to the function called %series, which would use the series_name field attached to the post? Something like:Next in the %series series: ', '%title'); ?> Resulting in: "Next in the Wordpress 2.0 plugins series: In-Series 4.1" or can you already do something like this, and I'm just not seeing it?
  • Charles Krause
    Damn - looks like my formatting codes screwed up the examples, sorry.
  • Starbuck
    Skippy - first thanks for your effort on all of your plugins! This is my first time using in-series and I'm a relatively new blogger. I'm using WP 2.0.1 with slight mods to Kubrick and in-series v2.0. I added a call in single.php to series_table_of_contents() which executes OK when $series=''. With any values for series_name and series_order, it chokes with error: "Warning: Invalid argument supplied for foreach() in /www/n/nebula/htdocs/blog/wp-content/plugins/in-series.php on line 143" which points to: foreach ($series_posts as $s_id => $s_title) I'm no PHP stud but I don't see anything wrong in there. Any ideas? Also, a minor note about in-series.txt: Your step-by-step instructions, after entering series_name, point 5 says to Click Add Custom Field, and 6 continues right along with adding series_order. Well, clicking Add Custom Field on a new post which hasn't been saved before does a page submit and refreshes with an empty post. You need to go find and edit the page to continue on. It might be good to revise step #2 to from "Before saving..." to "Use 'Save and Continue Editing' to save your post, then ...". Otherwise some mention will be required between #5 and 6. HTH
  • TS
    Hi. I just installed the In Series plugin and am getting 'call to undefined function' for all plugin functions. I've put the .php file in the plugins directory as /plugins/in-series.php and the permissions are correct. I've checked my database and the key/value pairs are recorded correctly. I've tried putting the in both the single.php and index.php files. No luck. Any advice?
  • Mark McGuinness
    Hi Skippy, Thanks for a great plugin - I'd never have worked out how to do that myself.
  • August 15th, 2006
  • 3DSL Eugen
    Hey Skippy, thanks for plugins and your job!
  • Mike Wittmann
    Starbuck, I had a similar problem, but only when there was just one post in a series (obviously, unless you go back and add series tags after you've got two posts, there will always be a point in time when only one post exists). I think PHP doesn't like the "for each" operator when only one "each" exists. I modified the code so that it checks for the number of posts in a series. If the number is less than 2, it displays a certain message. If it is 2 or more, it displays as it normally would. I'll try to post my code here (I hope I don't break anything!): if (2 > count($series_posts)) { #What to do if this is the only post in the series... echo ($before."This is the first post in this series. Stay tuned... ".$after); } else { #What to do if there are 2 or more posts in the series. $output = $before; foreach ($series_posts as $s_id => $s_title) { $output .= 'contact me via my blog and I'll e-mail the code to you. Cheers!
  • Jerry Peek
    Skippy, thanks for In-Series! Here are a few questions/comments: 1) I just found this post and its comment area on your site. I'd already posted a support message in wordpress.org/support/topic/96199. Summary of that message: I'd like next_in_series() and previous_in_series() to return just URLs, not links. Is that possible? 2) About series_table_of_contents(), the file in-series.txt from version 2.0 says "the tag ONLY outputs the list elements" (not the <ol> or <ul>). But later it lists three parameters and says that the default value for "before" is <ol> and for "after", </ol>. If I run series_table_of_contents() with no parameters, however, it generates the default <ol> and </ol> tags. Is in-series.txt correct? Or, if I don't want the default <ol> and </ol> tags, should I use empty "before" and "after" parameters? 3) A small typo in in-series.txt from version 2.0: the section describing all_series() says about the "after" argument: Default is "<ol>". I think that should be "</ol>". Thanks again.
  • Jerry Peek
    A week ago I posted a message to the WP support forum asking for help with a problem with the all_series() function from In-Series version 2.0: it only seems to return one series name, not all of them. (BTW, all_series() is only documented in the in-series.txt file, but not here on this blog page -- at least not yet.) I haven't gotten any answers, so I decided to hack on the plugin. My hack is in that support thread. It seems to work, but it's ugly. I'm no PHP or WordPress hacker, so I'd be glad for advice from someone who knows what they're doing!
  • skippy
    Jerry: I've stopped working on this plugin, so I'm unlikely to update this post. I've exchanged emails with someone who's planning to pick up where I left off. As soon as that finalizes, I'll make a new post with all the details.
  • Jerry Peek
    OK, thanks for the info. I'm probably going to base a lot of our site on the In-Series plugin: our Posts are in a particular order and the date they were posted doesn't matter. So I'll keep hacking to make version 2.0 do more of what I need. (That's mostly returning raw data that's not in the form of complete HTML.) If my edits might be useful for other people, I'd be glad to give them to the new maintainer.

About | Policies | skippy.net