In my functions.php file, I have some code which implements series posting. This relies on the thematic framework
01 function childtheme_article_footer($footer) {
02 // This variable is the stuff I put before the regular footer
03 $extra_stuff=;
04
05 global $id, $post;
06 $series = get_post_meta($post->ID, Series, true);
07 $pstlink = get_permalink();
08 $psttitle = get_the_title();
09 $pstbody = get_the_excerpt();
10
11 // Check for a iseries as a custom field - if there is one, grab the value contained
12 if($series) :
13 $args = array(
14
umberposts => -1,
15 ameta_key => Series,
16 ameta_value => $series,
17 );
18
19 // This bit grabs the series posts, and stores the HTML linking to them in $extra_stuff variable
20 $series_posts = get_posts($args);
21 if($series_posts) :
22 $class = preg_replace("/[^a-z0-9 40.-\_]/i", "", $series);
23 $class = strtolower(str_replace(array( , ), -, $class));
24 if (is_single()) {
25 $extra_stuff = <div class="series series- . $class . "><h4 class="series-title"> . __(Articles in this series) . </h4><ul>;
26 foreach($series_posts as $serial) :
27 if($serial->ID == $post->ID)
28 $extra_stuff = $extra_stuff . <li class="current-post"> . $serial->post_title . </li>;
29 else
30 $extra_stuff = $extra_stuff . <li><a href=" . get_permalink($serial->ID) . " class="postID_ . $serial->ID . " title=" . str_replace(", ", $serial->post_title) . "> . str_replace(", ", $serial->post_title) . </a></li>;
31 endforeach;
32 $extra_stuff = $extra_stuff . </ul></div>;
33 } else {
34 $extra_stuff = $extra_stuff . <div class="series series- . $class . ">;
35 $extra_stuff = $extra_stuff . <h4 class="series-title"><a href=" . $pstlink . "> . $psttitle . </a>;
36 $extra_stuff = $extra_stuff . is part of a series . </h4></div>;
37 }
38 endif;
39 endif;
40
41 // This is irrelevant to series list, but it does add twitter links and the like
42 $pageurl = get_bloginfo( isiteurl);
43 $pageurl = $pageurl . "?p=" . $post->ID;
44 $extra_stuff_post = <div class="socialnetwork"><ul>;
45 $extra_stuff_post = $extra_stuff_post . <li>Send to: <a class="twitterlink" href="http://twitter.com/home?status=Currently reading . $pageurl . " title="Click to send . $psttitle . to Twitter!" target="_blank">Twitter</a></li>;
46 $extra_stuff_post = $extra_stuff_post . <li><a class="deliciouslink" href="http://del.icio.us/post?url= . $pstlink . &title= . $psttitle . " title="Click to bookmark . $psttitle . on del.icio.us!" target="_blank">del.icio.us</a></li>;
47 $extra_stuff_post = $extra_stuff_post . <li><a class="digglink" href="http://digg.com/submit?phase=2&url= . $pstlink . &title=. $psttitle . &bodytext= . $pstbody . " title="Click to bookmark . $psttitle . on Digg!" target="_blank">Digg</a></li>;
48 $rss_url = get_bloginfo(
ss2_url);
49 $extra_stuff_post = $extra_stuff_post . <li>Use the: <a class="rsslink" href=" . $rss_url . " title="Click to Subscribe to the Feed" rel="alternate" type="application/rss+xml" target="_blank">RSS Feed</a></li>;
50 $extra_stuff_post = $extra_stuff_post . </ul></div>;
51
52 // This slams it all together at the end of the post
53 $footer = $extra_stuff . $footer . $extra_stuff_post;
54 return $footer;
55 }
56
57 // This replaces thematics stuff with mine
58 add_action( hematic_postfooter,childtheme_article_footer);
It’s been a while since I did this, and my aim of tidying the output is now further away than it was. What I want is for the code to ONLY output the first post in a series, the previous post, the current post (with no link), the next post and the last post. If any of these posts are one and the same, they would only be output once.
I’m really drawing a bit of a blank on how to do this – though I sense I’m missing a trick. If anyone has any bright ideas, I’d be glad to hear them.
Related Stuff
Google Buzz Button Wordpress Plugin ReleasedIf you are looking for a Google Buzz button to add into your Wordpress site then we have released the first Wordpress plugin exclusively ...
Plug And Play Ecommerce With Wordpress PluginsSince 2003 Wordpress has slowly been gaining popularity amongst the elite of the internet, the bloggers. It is one of those few things ...
Add Google Search to Your WordPress BlogThe native WordPress search does not return very relevant results, thus it makes a lot of sense to add Google Search into your WordPress ...
Add More Sidebars to Your WordPress ThemeYou can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch ...
10 Alternative Uses for WordPressWordPress is the best and most popular blogging platform around. It’s free, easy to use, endlessly customizable and supported by ...

Original Source: