July 20, 2010 | How-To: Easily Create “Previous” and “Next” Links for the Organize Series Plugin

Posted by joebeaudoin at 1:54 am
Topics: How-To,Programming,g33k | Tags: , , , , ,

For the new website I’m developing (you can see a clearly unfinished, work-in-progress preview of it here), I am using the Organize Series plugins designed for WordPress. That plugin is designed to organize a bunch of blog posts into a series, like a series on hot women in the Marvel universe. For my purposes, I needed to organize the lots under one specific auction, with navigation links in the sub-menu. (See this.) I ran into a problem when needing to create separate links for articles within the series. Basically, I had no way to dynamically call the unique id number associated to the series, and found I’d have to hardcode it.

I went to Google and ran a search, discovering that I was not alone in having this problem. Further, there was no apparent solution offered.

So I decided that I would have to hack the code by creating two new functions: one to create a “previous” link and the other a “next” link. These new functions would tie into the function (called wp_series_nav) that was already present to generate the links—although it did not possess the means to actually grab the dynamic series ID without a bunch of effort.

So I went to the source file (series-template-tags.php) and modified it to create these two functions:

  • wp_series_nav_prev()
  • wp_series_nav_next()

It’s a real quick hack, and you’ll need to add these functions before the wp_series_nav() function that’s located around line 609.

function wp_series_nav_prev($customtext = FALSE, $display = FALSE) {

	wp_series_nav($series_ID, $next = FALSE, $customtext, $display);

}

function wp_series_nav_next($customtext = FALSE, $display = FALSE) {

	wp_series_nav($series_ID, $next = TRUE, $customtext, $display);

}

… and that’s it! Now you’ll be able to add the new functions to your blog’s page template. Cool, eh?

Important Note: As with any other plugin, whenever you install an update from the publisher for said plugin you will be overwriting any changes you made to the code. So make sure that you modify the code again after the update to reproduce the modifications noted in this article! Do keep in mind that should the files from said update be totally recoded, the above code may or may not work as intended. (The lines may not be there or may have moved to an entirely new file, for instance.)

No Comments | Leave a comment »
No comments or pings yet.

Leave a comment

Powered by WP Hashcash

 

Twidddle, Twaddle, Twitter, Twatter

Tweets for twats.

XBox Live

Gaming for geeks.

Friends Blogs

Check out my friends's blogs as well.