== In-Series == Tags: series, sequential, connected, article series, linking posts, post series Contributors: Lorelle (http://codex.wordpress.org/User:Lorelle), ColdForged (http://www.coldforged.org), nectoric (http://www.girsbrain.org), Scott (http://www.skippy.net) 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. == Installation == 1. Install in-series.php into your wp-content/plugins directory. 2. 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_content() If you're not using (or don't have) single.php, then place these template tags in index.php after your post content and before your next and previous page navigation tags. === Existing users (upgrading) === If you wrote posts with metadata for a version of In-Series prior to 2.1, you will notice that you are no longer required to manually enter metadata in the custom fields section of your post. However, because newer versions of In-Series use different names for the database metadata keys, your existing posts will need to be upgraded. Fortunately, this process is mostly automatic; simply do the following: 1. Ensure that the plugin is installed with its original filename (in-series.php) 2. If the in-series plugin shows up as active in the plugin control panel, deactivate it and then activate it again. In-Series will update your database to ensure that any old-style metadata is brought over to the new format. Writing your own SQL queries against In-Series metadata is not recommended. However, if you have already created your own custom SQL queries using the pre-2.1 format, you will need to update your queries to use _series_name and _series_order instead of series_name and series_order (respectively). If you think that In-Series does not provide a template tag that it should, please let the author know. == Usage == In-Series has a UI that makes it easy to create new series, and add new posts to the end of existing series. However, it is critical to note that In-Series merely provides a UI for creating metadata, and template functions to access that metadata -- In-Series does NOT magically cause links and series titles to appear in your posts (but that's coming). For now, you must add In-Series function calls to your templates in order to actually link your posts together. In order to create a new series, you can follow these steps: 1. Create the first post in the series. 2. Before saving, expand the "In Series" sidebar (if it's not already expanded). 3. Enter the title of your series in the "New series name" field. This must not conflict with any existing series name. 4. Click Save or Publish. In order to add a new post to the beginning or end of a series: 1. Create the next post in the series. 2. Before saving, expand the "In Series" sidebar (if it's not already expanded). 3. From the drop-down menu, select the series that you wish to add to. 4. Select the appropriate radio button to append (add to the end) or prepend (add to the start) your post to the series. The In Series data for each post, by itself, doesn't do anything. When the In-Series plugin is activated, though, several new template tags are available which does use the In-Series data. These new template tags only output when viewing a single post. When these new template tags are called on an index, archive, category, or any non-single-post view template file, they will silently do nothing. The tags will generate the series information when viewing a single post that is part of a series as defined by the In-Series metadata. By default, if there is no next or previous article in the series, that link will not appear. The default usage also does not highlight the current page in a link. The following functions will output links as described below. If the post is not part of a series (as defined by the In-Series metadata), the template tags will not display anything; so it's safe to add these tags to your default template(s). If the plugin is deactivated, you will need to remove or comment out these tags. 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. 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. 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. displays each post's title as a clickable link to that post, as
  • elements in an ordered list. The current post is not linked, to ensure the reader knows where in the series they are. displays a list of each unique series, listed by series name with a link to the first post in each series. == Advanced == === Next and Previous === The next and previous series template tags can be called with no parameters: and they output a link that looks something like this: Writing a WordPress Plugin Part 2 » By default, the title of the next post will be used for the link. You can modify the output by passing the following variables to the function: * format The format parameter features the format for the text before or after the link. The default usage features '%link »' for next_in_series() and '« %link' for previous_in_series(). * link This parameter sets the link usage. The default, '%title', will use the post's title. An example would be: Next in the series: ', '%title'); ?> which would produce Next in the series: Writing a WordPress Plugin Part 2 » This example will create a link to the next post in the series (if there is one) with the word "NEXT" for the link, instead of the post's title. Writing a WordPress Plugin Part 2 NEXT » This example will create a link to the next post in the series (if there is one) with "Next Up: " followed by the post's title. Next Up: Writing a WordPress Plugin Part 2 » If you want to simply remove the little arrows from the links, use this: previous_in_series('%link'); next_in_series('%link'); === All in Series === The all_in_series() function also works without arguments, producing the following: Read the whole series: 1,2,3 Where "1,2,3" are links to the series' posts. The current page is not linked in the list. The parameters are: * separator What to place between the links to the posts. Default is a comma (','). * before What to place before the list of links. Default is '« Read the whole series: ' * after What to place after the list of links. Default is ' »' To change the text and put the entire thing in an HTML paragraph tag: The whole shebang: ', '

    '); ?> The whole shebang: 1,2,3 If you want to remove the little arrows (»), use this: all_in_series(',', 'Read the whole series: ', ' '); === Table of Contents === The series_table_of_contents() function will produce HTML list elements for each post in the series:
  • Part 1
  • Part 2
  • Part 3
  • Note that the tag ONLY outputs the list elements. This allows you to use ordered or unordered lists as you wish:
    will produce an ordered list of your series' posts. The function accepts three single parameters: * class if specified, this is the name of a CSS class that will be applied to each list element:
  • * before HTML to display before the start of the table of contents. Default is "
      " * after HTML to display after the table of contents. Default is "
    " ===All Series=== The all_series() tag will produce an ordered list of links to the first post in each series, sorted ascending by the series names. The function accepts three arguments: * before HTML to display before the start of the list. Default is "
      " * after HTML to display after the end of the list. Default is "
        " * order Whether to order the list by the name of the series, or by the post ID of the first post in each series. Default is "name". To create an unordered list of series, ordered by the post ID of the first post in each series: ', '', 'id'); ?> == Frequently Asked Questions == Q. Can one post be assigned to two or more series? A. Not at this time. It's on my to-do list. == Credits == Copyright (c) 2005 Scott Merrill (skippy@skippy.net) Copyright 2006, 2007 Travis Snoozy Released under the terms of the GNU GPL v2 Documentation: Lorelle (http://www.cameraontheroad.com/)