arrow-left arrow-right brightness-2 chevron-left chevron-right facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Smart Archives v1.5
1 min read

Smart Archives v1.5

I’ve just pulled the covers off of Smart Archives v1.5; changes to the plugin are outlined below.

Category exclusion

As mentioned here, insinuating circumstances led me to have to develop category exclusion for Smart Archives, which proved to be a bit harder to implement than I thought it would (or should) be, because, as it turns out, WordPress doesn’t store category information in the wp_post table, but instead uses a separate table called post2cat.

I initially had the code setup such that it would only check the first element of the category array, which meant that the category you were trying to exclude had to be the only category attached to a particular post (in which case it would be the first and only element of the array). While this worked for my situation (and truthfully, I still do it that way because it’s faster), I knew that others would likely have multiple categories assigned to individual posts. Because of this fact, I ended up having to cycle through the array looking for any instance of the excluded category, no matter where it fell. If anyone knows of a faster, better way of doing this, please let me know.

Options

Smart Archives now accepts two arguments. The first tells the plugin what to display: block of years/months, list of years, months, and posts, or both. The second allows you to specify a category to be excluded from the list (see above).

As ever, the project page has been updated to comport with all of these changes. Enjoy.

You've successfully subscribed to Justin Blanton.
Success! Your account is fully activated, you now have access to all content.