Create a category-specific series box with WordPress, Thesis and Organize Series

In: , , ,

I use the terrific Organize Series Plugin for WordPress, which I highly recommend for anyone who regularly posts multi-part blog series. You can see it in action on series all over this site, such as my recent series on 7 days to inbox zero. It lets you easily add posts to a series, manages the part numbering very efficiently, and gives you options for displaying (and styling) series boxes within your series posts, as well as creating archive pages for each series. In other words, it’s very handy.

But my latest series looking at 40 years online is so long and so particular that it required a different approach. After all, I didn’t want to end up with a 40-item-long series box. And I want a special box to display a few key events from each year in the series. So I initially suppressed the series box in each post by simply adding a line to the beginning of each post:


Then I manually added the events for each year and manually created links to the previous and subsequent year’s post. This turned out to be a major headache: I won’t bore you with all the reasons why.

I’m now on a massive PHP-learning odyssey to come up with a better option, and along the way I’ve dug into the challenges of fiddling with Organize Series so that it plays nicely with the highly configurable Thesis theme. One of my first successes is probably widely relevant to anyone using both Thesis and Organize Series, so I’m noting it here, even though it is actually very simple and there is not much to document.

Directions

In Custom_Functions.php

In the custom_functions.php file for Thesis, add the following code. (Replace “one-40-year-old” with the category slug for the category in which you want to exclude your series box.)


//show seriesbox everywhere except one-40-year-old category
function show_seriesbox(){
if (!in_category('one-40-year-old'))
echo wp_postlist_display();
}
add_action('thesis_hook_before_post', 'show_seriesbox');

In Series Options

To make this work I still had to do two things on the Organize Series Options page in the Dashboard. These steps were suggested by a discussion about moving the series box that is on the Organize Series forms. (Note: Forums are only accessible to people who have paid for the support package.)

  1. Unchecked “display series post list box”
  2. Deleted the two appearances of %postcontent% in the Series Post List Template

Notes

The major limitation of this approach is that the “if” statement is based on a category name rather than a series name. That works fine in this case (I’m putting all the posts in this series into a specially created category) but in future I can imagine there will be series for which I might want to suppress or modify the series box, but for which I will not have a unique category. I hope Darren will jump in with a suggestion for how to write an “if” statement based on the series name instead.

It would be nice to theme different series boxes differently depending on category or series name. My hunch is that the way to do this would be to enclose the wp_postlist_display(); in a div tag that declares a style class for that particular series, but I haven’t tried it yet and don’t know if it would get overridden. Another way to go is to actually build a function out of the code in organizeseries_template_tags.php, which I suspect I’ll have to get into in order to make my special series box work correctly for the One 40-year-old series.

Note: this post was written on April 3, and not March 3 as indicated. I didn’t want to mess up the flow of my One 40-year-old series and I didn’t want to get sidetracked in another tech project trying to suppress its display, so I just backdated.

2 Comments on this site

  1. Organize Series

    And jump in I will :). There is an “in_series()” function available and it should work with either the series_id or the series slug for the series you want to control. Try it out and let me know.

    GREAT WORK on figuring this out and posting it for others!! (and thanks for the nice words about Organize Series too)

    Also, you can use the in_series function for doing the styling as you suggested too 🙂

  2. Bhanu Pratap

    How I can have category boxes on home page with nice look? kindly share any idea

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This