Category Archives: Site News

WordPress on a new subdomain

Thanks to the nice people at Hostmonster tech support (Christopher), without moving any of my files, I now have a new web address for the WordPress install, that is http://blog.murky.org/

What gave me a little confusion, soon overcome, was that even though my registrar is now hover, hostmonster can still manage the domain, that is because hover points at the old nameservers, which are hostmonster’s. So, why the move? It’s about separating out different roles – not having everything in one spot. If I ever want to break links with hostmonster, I can do this entirely from within hover by resetting the domain nameserver.

Anyhow, to create http://blog.murky.org/ I had to do was go to the subdomain management tools (which is on the top menu of hostmonster, not an icon on the main cpanel page) and make a subdomain which I directed to the directory containing WordPress.

As I type, this is also where www.murky.org is directed, I did it with an overlap so that mid-change I could still access the WordPress admin pages under one naming scheme or the other.

Creating the subdomain using the management tools also created the appropriate A name records too. I shouldn’t have needed tech support really in hindsight, but messing with domains is one of those things that you do very rarely, and so each time you do it, it is as new. If I had to do this task again tomorrow, no problem…. but in a year? I hope the above text will be enough!

I wanted to fix old links – and that was done with a WordPress plugin called ‘search regex’ – a quick search in post content for links to my old domain, and replacing with the new… job done. I also went into WordPress settings to change the URL there.

The next step is to cause www.murky.org to go to a different host – that is a job for another day – and it’s a slightly different task, so it’s back to square one.

If I was starting from scratch, would I do it this way? Hell no, I’d have the subdomains all with the registrar.

Latex for WordPress

I’ve just installed ‘Jetpack‘ which comes with \LaTeX. This post is to provide a quick reference. \LaTeX parses the text in the WordPress post, and lays out the display as a graphic for the viewer. Though someone reading this will see images, there are no images referred to in the edited post.

\LaTeX is a generalised document layout language, but as far as I am concerned, the main use of \LaTeX in WordPress is mathematical.

Note that as the images are generated on the fly, the page will be slower to load than if the page were pre-rendered. Therefore, I think it may still be best for the web to generate the image, save it and then display the result via an <img> tag (keeping the \LaTeX hidden in a comment so that the image can be regenerated if need be). As already mentioned, I have not pre-generated the images for this post, it is all done in code.

It’s a pity that MathML isn’t well supported at the moment.
Continue reading Latex for WordPress

Back up Google Calendar on Mac OS X

I wanted to ensure that I had a local backup of google calendar on my own computer. This is how I’ve done it. Of course, with anything like this, if you try and do the same, then you will be taking responsibility for your own foulups!

First, I opened terminal and changed to my script directory

cd ~/Documents/scripts

Where you store your scripts is up to you, if you don’t have a script directory, make one first by typing:

mkdir ~/Documents/scripts

Then, I made a script and made it executable. I use vi for editing, if you are not happy with vi, then open it in your text processor of choice (with vi, hit i to start editing, then escape w q return to save and quit, escape q ! return to quit only)

touch calbackup
chmod 755 calbackup
vi calbackup

Here is my script. You will need to go to google calendar, go to the settings of each calendar you want to back up and then copy and paste the private ical URL.

Any line with # at the start (except the first) can be deleted. Honestly, you can probably delete the first, but it’s not hurting, best to keep it.

#!/bin/bash

# change this to where you wish to store your calendar backup
cd ~/Documents/Dropbox/Private/Calendars

# these are variables which will be used
day=$(date +%d)
month=$(date +%m)

# this will be used to create directories of the form month-07
month="month-${month}"

# if we don't have a subdirectory for that month, make it
if [ ! -d "$month" ]; then
   mkdir $month
fi

# get the calendars. Repeat these as needed. 
# Change the URL to those the private ical URL of your calendars
# Obtain this by going to google calendar and using 'settings'
# on each calendar in turn

# Also, change the local name of the calendar 
# '-master.ics' , '-birthday.ics' etc. each time
curl -silent -k (PrivateUrltoCalendar) > "${day}-master.ics"
curl -silent -k (PrivateUrltoCalendar2) > "${day}-birthday.ics"

# I have about 10 entries in the above section, you will have
# as many entries as you have calendars.
# To avoid spamming the google server 
# (like a fly splatting a locomotive)
# you may want to introduce a pause 
# between each 'curl' with something like 'sleep 1m'


# So far, we have a backup every time we run the script,
# each day produces a new backup

# Now, I will have daily backups for the last month, 
# let's make a monthly backup

# I always want the most up to date to be the monthly backup,
# but I only want backup per month.

# I don't want to redownload again, it may be easier,
# but it is so slower, and would require two edits
# if the calendar URL changes. 

# Let's rename what we have.

for file in ${day}*.ics
do
  newloc=$(echo $file | sed 's/[0-9]*-//g')
  newloc=$(echo $month/$newloc)
  cp $file $newloc
done

If you prefer to have code without comments, here’s a version and I’ve included the change discussed in the comments below (don’t forget to also make the changes detailed above):

#!/bin/bash

cd ~/Documents/Dropbox/Private/Calendars

day=$(date +%d)
month=$(date +%m)
month="month-${month}"

if [ ! -d "$month" ]; then
   mkdir $month
fi

curl -silent -k (PrivateUrltoCalendar) | awk '/BEGIN:VCALENDAR/,0' > "${day}-master.ics"
curl -silent -k (PrivateUrltoCalendar2) | awk '/BEGIN:VCALENDAR/,0' > "${day}-birthday.ics"

for file in ${day}*.ics
do
  newloc=$(echo $file | sed 's/[0-9]*-//g')
  newloc=$(echo $month/$newloc)
  cp $file $newloc
done

Assuming you’ve made the appropriate changes, you can run your script by typing ./calbackup (or just calbackup if you have set the path to your script directory).

There will be a pause, and after about 10 seconds (for me, you may take longer), the command prompt reappears. Navigating to the directory where I have backups shows my daily backups of the form 29-master.ics, 29-birthday.ics etc – and there is a subdirectory with master.ics, birthday.ics etc.

When the month ticks over, that subdirectory will no longer be updated, and a new one will start to be maintained. Thus, if we run the script daily, we will have a monthly backup (lasting 12 months) and daily backups for the last month.

I do not wish, however, to have to remember to run the script.

So now I want to automate the process. If you don’t like vi, use your editor of choice.

cd ~/Library/LaunchAgents
touch com.google.calendar.mine.plist
chmod 644 com.google.calendar.mine.plist
vi com.google.calendar.mine.plist

Within com.google.calendar.plist, I need to tell the computer where the script is, and also how often I want it to run. You will need to ensure that the path is correct for your script, e.g. mine is in ~/Documents/scripts, so my path is /Users/myusername/Documents/scripts/calbackup

I want it to run every 6 hours (more than needed, but I’d rather that than too few, also I don’t want it running all the time). I might even increase this time to eight or 12 hours. I don’t think I’d go for 24, as if there is a network issue when the script runs, no backup is made that day. Six hours in seconds is 6x60x60 or 21600.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.google.calendar</string>
        <key>ProgramArguments</key>
        <array>
                <string>/bin/sh</string>
                <string>/path/to/your/scripts/calbackup</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StartInterval</key>
        <integer>21600</integer>
</dict>
</plist>

Then finally, to get it going without a reboot needed:

launchctl load com.google.calendar.mine.plist

(If you run this again, the second time you’ll get a message saying it is already loaded).

It seems to work for me (admittedly, I’ve only just finished this – so there may be a bug which rears its head later) – but it seems to be okay. I do hope this is useful to you.

Series Linking – A solution

A while ago, I posted about a problem I was having with series links. I usually would post the solution soon after, but it seems I forgot.

I can’t recall the process of how I got to this solution, so apologies for not linking anywhere I should to give credit, but this is what I have in my functions.php now.

Things I’d like to work out are:
Can I have a post in more than one series (with current code, no, I suspect a rewrite may be in order for that)
Can I have a second type of series link, one to link to another series? Ideally, this would be ‘previous series’ and ‘next series’. I suspect I wouldn’t want to attach these relations to posts, as I’d want the links to be on the last and first posts in a series, and that may change with new posts being added.
Can I list the names of series which I have defined on an admin page somewhere? Ideally, with the post titles listed right there alongside.

[php]function mrk_theme_article_footer($content)
{
$newcontent = $content;
$psttitle=get_the_title();

global $id, $post;

// Check to see if this post is part of a series, if it isn’t skip
$series = get_post_meta($post->ID, ‘Series’, true);
if ($series) :
$args = array(
‘numberposts’ => -1,
‘meta_key’ => ‘Series’,
‘meta_value’ => $series,
‘orderby’ => ‘post_date’,
‘order’ => ‘asc’,
);
$series_posts = get_posts($args);

// Check how many posts have been grabbed – if only 1, then move on
$seriescount = count($series_posts);
if ($seriescount > 1)
{
// Now to throw away all but the first, previous, current, next and last base this on date.
// First let’s initialise all the variables – these values will change soon!
$currpostdate = $post->post_date;
$currpostID = $post->ID;

$lastpostdate = $currpostdate;
$lastpostID=$currpostID;

$firstpostdate = $currpostdate;
$firstpostID = $currpostID;

$nextpostdate = $currpostdate;
$nextpostID = $currpostID;

$prevpostdate = $currpostdate;
$prevpostID = $currpostID;

$counter = 0;

foreach ($series_posts as $serial) :
// Check for two key posts earlier than this – first look if I have an earlier post than the known earliest
// currpost refers to the post currently selected in the loop
// firstpost refers to the first post in a series – lastpost similar
// prev and next refer to the next and prev post in a series
// serial refer to the current series post being examined to see if it may be one of the above
$counter=$counter +1;
if ($serial->post_date < $firstpostdate)
{
$firstpostdate = $serial->post_date;
$firstpostID=$serial->ID;
if ($prevpostdate == $currpostdate)
{
// I have an earlier post than the current one, so if the previous post is set to point at the current post, change this
$prevpostdate = $firstpostdate;
$prevpostID = $firstpostID;
}
}

// Is the post found dated between the current post and the current date for previous post?
if ($serial->post_date < $currpostdate)
{
if ($serial->post_date > $prevpostdate )
{
$prevpostdate = $serial->post_date;
$prevpostID = $serial->ID;
}
}
if ($serial->post_date > $lastpostdate)
{
$lastpostdate = $serial->post_date;
$lastpostID=$serial->ID;
if ($nextpostdate == $currpostdate)
{
$nextpostdate = $lastpostdate;
$nextpostID = $lastpostID;
}
}
if ($serial->post_date > $currpostdate )
{
if ($serial->post_date < $nextpostdate )
{
$nextpostdate = $serial->post_date;
$nextpostID = $serial->ID;
}
}

if ($serial->post_date == $currpostdate)
{
$postnumber = ordinal_suffix($counter,1);
}
endforeach; // I now know the first, prev, next and last in series

// First, we’ll do some database lookups to get the info needed. I know it’s already in an array, but I’m being lazy
$firstpostarray=get_post($firstpostID);
$firsttitle = $firstpostarray->post_title;
$firstlink = get_permalink($firstpostID);

$prevpostarray=get_post($prevpostID);
$prevtitle = $prevpostarray->post_title;
$prevlink = get_permalink($prevpostID);

$lastpostarray=get_post($lastpostID);
$lasttitle = $lastpostarray->post_title;
$lastlink = get_permalink($lastpostID);

$nextpostarray=get_post($nextpostID);
$nexttitle = $nextpostarray->post_title;
$nextlink = get_permalink($nextpostID);

$seriesclass = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $series);
$seriesclass = ‘series-‘ . strtolower(str_replace(array(‘ ‘, ‘ ‘), ‘-‘, $seriesclass));

// Single posts are handled differently to summary posts
if (is_single())
{
// Create a div to hold the links
$extra = ‘<div class="series seriessingle ‘ . $seriesclass . ‘"><h4 class="series-title">Series Information</h4>’;
$extra = $extra . ‘<ul>’;

// This bit of code is for first and last pages
if ($firstpostID == $currpostID || $lastpostID == $currpostID)
{
// If the first or last post, show the whole list of links
$extra = $extra . ‘<p>&quot;’ . $psttitle . ‘&quot; is the ‘;
if ($firstpostID == $currpostID)
{
$extra = $extra . ‘first’;
}
else
{
$extra = $extra . ‘last’;
}
$extra = $extra . ‘ in a sequence of ‘ . $seriescount . ‘ posts</p>’;

// For the first and last post only show the full list
foreach ($series_posts as $serial) : //Output list of posts
$extra = $extra . ‘<li>’;
if ($serial->ID == $currpostID)
{
$extra = $extra . ‘<strong>This post: </strong> ‘ . $psttitle;
}
else
{
$extra = $extra . ‘<a href="’ . get_permalink($serial->ID) . ‘">’ . $serial->post_title . ‘</a>’;
}
$extra = $extra . ‘</li>’;
endforeach; // Finish outputting list of posts
$extra = $extra .'</ul>’;
$extra = $extra . ‘</div> <!– end of series stuff –>’;
} // The above bit was for first and last pages
else
{ // Output a display for posts other than the first and last.
$extra = $extra . ‘<p>&quot;’ . $psttitle . ‘&quot; is ‘. $postnumber .’ in a larger sequence of ‘ . $seriescount .’ posts</p>’;
$extra = $extra . ‘<ul>’;

// Is the previous post the first post?
if ($firstpostID == $prevpostID)
{
$extra = $extra . ‘<li><a href="’. $firstlink .’">’. $firsttitle. ‘</a> – First in Series (and Previous Post)</li>’;
}
else
{
$extra = $extra . ‘<li><a href="’. $firstlink .’">’. $firsttitle. ‘</a> – First in Series</li>’;
$extra = $extra . ‘<li><a href="’. $prevlink .’">’. $prevtitle. ‘</a> – Previous Post</li>’;
} // End output first and previous
// Is the next post the last post?
if ($nextpostID == $lastpostID)
{
$extra = $extra . ‘<li><a href="’. $nextlink .’">’. $nexttitle. ‘</a> – Next in Series (and Last Post)</li>’;
}
else
{
//End next post is last post
$extra = $extra . ‘<li><a href="’. $nextlink .’">’. $nexttitle. ‘</a> – Next Post</li>’;
$extra = $extra . ‘<li><a href="’. $lastlink .’">’. $lasttitle. ‘</a> – Last in Series</li>’;
} // End output next and last
$extra = $extra .'</ul>’;
$extra = $extra . ‘</div> <!– end of series stuff –>’;
}
} // End of code if it is a single post

else
{ //Now do summary posts
$extra = ‘<div class="series seriessummary "’ . $seriesclass .’"><p>’;
if ($currpostID == $firstpostID)
{
// For the first post in the series, link to the latest post
$extra = $extra . ‘This post is the first in a series of ‘ . $seriescount .’ posts, the latest is ‘;
$extra = $extra . ‘<a href="’ . $lastlink . ‘">’ . $lasttitle . ‘</a></p>’;
}
else
{
// For any post in the series, link to the first post

$extra = $extra . ‘This post is ‘;

// The latest post is a special case
if ($currpostID == $lastpostID)
{
$extra = $extra . ‘the latest in’;
}
else
{
$extra = $extra . ‘part of’;
}
$extra = $extra . ‘ a series of ‘ . $seriescount .’ posts which begins with <a href="’;
$extra = $extra . $firstlink;
$extra = $extra . ‘">’ . $firsttitle . ‘</a>’;

// If not the latest post, link to that.
if ($currpostID == $lastpostID)
{
$extra_stuff_post = $extra_stuff_post . ‘. ‘;
}
else
{
$extra_stuff_post = $extra_stuff_post . ‘, the latest post in the series is <a href="’;
$extra_stuff_post = $extra_stuff_post . $lastlink . ‘">’ . $lasttitle . ‘</a>.’;
}
$extra_stuff_post = $extra_stuff_post . ‘</p>’;
}
$extra = $extra . ‘</div> <!– end of series stuff –>’;
} // End of Summary posts series code
} // End of what to do if series has several links

$newcontent = $content . $extra;
endif; // End of series code

return $newcontent;
}
// ——————————————————

add_filter(‘the_content’, ‘mrk_theme_article_footer’);[/php]

WordPress Problem – Series Posts

NOTE: Problem fixed – code unedited from the bugged version

———-
On my private ‘test-bed’ installation, I thought I’d update my Series post function for compatibility with TwentyEleven WordPress Theme and standard hooks, as opposed to Thematic.

The idea is that I add a custom field to my posts called ‘Series’ with a value of my choosing – and then the script adds links to other posts in the same series.

It works, in that single posts and some summary posts are formatted as required – but when a summary has NON series link posts, it breaks. I don’t see why, as far as I can see it should simply return the original content unaffected if the post being processed isn’t a series link. Worse, it doesn’t simply break that post on a summary page, but it stops processing other posts.

As I type, I have an earlier version working on this site – and it is this which was modified – however, I can see nothing that would prevent posts appearing on summary pages.

I can’t see the error – I would appreciate any insights readers may have.

On my test-bed site, in functions.php I have the following:

[php]function mrk_theme_article_footer($content)
{
$original_content = $content;
$psttitle = get_the_title();
$pstbody = get_the_excerpt();
$siteurl = get_bloginfo(‘wpurl’);
$themeurl = get_bloginfo(‘stylesheet_directory’);
$pageurl = get_permalink($post->ID);

$extra = ”;

global $id, $post;

// Check to see if this post is part of a series, if it isn’t skip
$series = get_post_meta($post->ID, ‘Series’, true);
if ($series) :
$args = array(
‘numberposts’ => -1,
‘meta_key’ => ‘Series’,
‘meta_value’ => $series,
‘orderby’ => ‘post_date’,
‘order’ => ‘asc’,
);
$series_posts = get_posts($args);

// Check how many posts have been grabbed – if only 1, then move on
$seriescount = count($series_posts);
if ($seriescount > 1)
{
// Now to throw away all but the first, previous, current, next and last base this on date.
// First let’s initialise all the variables – these values will change soon!
$currpostdate = $post->post_date;
$currpostID = $post->ID;

$lastpostdate = $currpostdate;
$lastpostID=$currpostID;

$firstpostdate = $currpostdate;
$firstpostID = $currpostID;

$nextpostdate = $currpostdate;
$nextpostID = $currpostID;

$prevpostdate = $currpostdate;
$prevpostID = $currpostID;

$counter = 0;

foreach ($series_posts as $serial) :
// Check for two key posts earlier than this – first look if I have an earlier post than the known earliest
// currpost refers to the post currently selected in the loop
// firstpost refers to the first post in a series – lastpost similar
// prev and next refer to the next and prev post in a series
// serial refer to the current series post being examined to see if it may be one of the above
$counter=$counter +1;
if ($serial->post_date < $firstpostdate)
{
$firstpostdate = $serial->post_date;
$firstpostID=$serial->ID;
if ($prevpostdate == $currpostdate)
{
// I have an earlier post than the current one, so if the previous post is set to point at the current post, change this
$prevpostdate = $firstpostdate;
$prevpostID = $firstpostID;
}
}

// Is the post found dated between the current post and the current date for previous post?
if ($serial->post_date < $currpostdate)
{
if ($serial->post_date > $prevpostdate )
{
$prevpostdate = $serial->post_date;
$prevpostID = $serial->ID;
}
}
if ($serial->post_date > $lastpostdate)
{
$lastpostdate = $serial->post_date;
$lastpostID=$serial->ID;
if ($nextpostdate == $currpostdate)
{
$nextpostdate = $lastpostdate;
$nextpostID = $lastpostID;
}
}
if ($serial->post_date > $currpostdate )
{
if ($serial->post_date < $nextpostdate )
{
$nextpostdate = $serial->post_date;
$nextpostID = $serial->ID;
}
}

if ($serial->post_date == $currpostdate)
{
$postnumber = ordinal_suffix($counter,1);
}
endforeach; // I now know the first, prev, next and last in series

// First, we’ll do some database lookups to get the info needed. I know it’s already in an array, but I’m being lazy
$firstpostarray=get_post($firstpostID);
$firsttitle = $firstpostarray->post_title;
$firstlink = get_permalink($firstpostID);

$prevpostarray=get_post($prevpostID);
$prevtitle = $prevpostarray->post_title;
$prevlink = get_permalink($prevpostID);

$lastpostarray=get_post($lastpostID);
$lasttitle = $lastpostarray->post_title;
$lastlink = get_permalink($lastpostID);

$nextpostarray=get_post($nextpostID);
$nexttitle = $nextpostarray->post_title;
$nextlink = get_permalink($nextpostID);

$seriesclass = preg_replace("/[^a-z0-9\\040\\.\\-\\_\\\\]/i", "", $series);
$seriesclass = ‘series-‘ . strtolower(str_replace(array(‘ ‘, ‘ ‘), ‘-‘, $seriesclass));

// Single posts are handled differently to summary posts
if (is_single())
{
// Create a div to hold the links
$extra = ‘<div class="series seriessingle ‘ . $seriesclass . ‘"><h4 class="series-title">Series Information</h4>’;
$extra = $extra . ‘<ul>’;

// This bit of code is for first and last pages
if ($firstpostID == $currpostID || $lastpostID == $currpostID)
{
// If the first or last post, show the whole list of links
$extra = $extra . ‘<p>&quot;’ . $psttitle . ‘&quot; is the ‘;
if ($firstpostID == $currpostID)
{
$extra = $extra . ‘first’;
}
else
{
$extra = $extra . ‘last’;
}
$extra = $extra . ‘ in a sequence of ‘ . $seriescount . ‘ posts</p>’;

// For the first and last post only show the full list
foreach ($series_posts as $serial) : //Output list of posts
$extra = $extra . ‘<li>’;
if ($serial->ID == $currpostID)
{
$extra = $extra . ‘<strong>This post: </strong> ‘ . $psttitle;
}
else
{
$extra = $extra . ‘<a href="’ . get_permalink($serial->ID) . ‘">’ . $serial->post_title . ‘</a>’;
}
$extra = $extra . ‘</li>’;
endforeach; // Finish outputting list of posts
$extra = $extra .'</ul>’;
$extra = $extra . ‘</div> <!– end of series stuff –>’;
} // The above bit was for first and last pages
else
{ // Output a display for posts other than the first and last.
$extra = $extra . ‘<p>&quot;’ . $psttitle . ‘&quot; is ‘. $postnumber .’ in a larger sequence of ‘ . $seriescount .’ posts</p>’;
$extra = $extra . ‘<ul>’;

// Is the previous post the first post?
if ($firstpostID == $prevpostID)
{
$extra = $extra . ‘<li><a href="’. $firstlink .’">’. $firsttitle. ‘</a> – First in Series (and Previous Post)</li>’;
}
else
{
$extra = $extra . ‘<li><a href="’. $firstlink .’">’. $firsttitle. ‘</a> – First in Series</li>’;
$extra = $extra . ‘<li><a href="’. $prevlink .’">’. $prevtitle. ‘</a> – Previous Post</li>’;
} // End output first and previous
// Is the next post the last post?
if ($nextpostID == $lastpostID)
{
$extra = $extra . ‘<li><a href="’. $nextlink .’">’. $nexttitle. ‘</a> – Next in Series (and Last Post)</li>’;
}
else
{
//End next post is last post
$extra = $extra . ‘<li><a href="’. $nextlink .’">’. $nexttitle. ‘</a> – Next Post</li>’;
$extra = $extra . ‘<li><a href="’. $lastlink .’">’. $lasttitle. ‘</a> – Last in Series</li>’;
} // End output next and last
$extra = $extra .'</ul>’;
$extra = $extra . ‘</div> <!– end of series stuff –>’;
} // End of code if it is a single post
}
else
{ //Now do summary posts
$extra = ‘<div class="series seriessummary "’ . $seriesclass .’"><p>’;
if ($currpostID == $firstpostID)
{
// For the first post in the series, link to the latest post
$extra = $extra . ‘This post is the first in a series of ‘ . $seriescount .’ posts, the latest is ‘;
$extra = $extra . ‘<a href="’ . $lastlink . ‘">’ . $lasttitle . ‘</a></p>’;
}
else
{
// For any post in the series, link to the first post
$extra = $extra . ‘This post is ‘;

// The latest post is a special case
if ($currpostID == $lastpostID)
{
$extra = $extra . ‘the latest in’;
}
else
{
$extra = $extra . $postnumber . ‘ in’;
}
$extra = $extra . ‘ a series of ‘ . $seriescount .’ posts which begins with <a href="’;
$extra = $extra . $firstlink;
$extra = $extra . ‘">’ . $firsttitle . ‘</a>’;
$extra = $extra . ‘the latest in’;
}
else
{
$extra = $extra . $postnumber . ‘ in’;
}
$extra = $extra . ‘ a series of ‘ . $seriescount .’ posts which begins with <a href="’;
$extra = $extra . $firstlink;
$extra = $extra . ‘">’ . $firsttitle . ‘</a>’;

// If not the latest post, link to that.
if ($currpostID == $lastpostID)
{
$extra = $extra . ‘. ‘;
}
else
{
$extra = $extra . ‘, the latest post in the series is <a href="’;
$extra = $extra . $lastlink . ‘">’ . $lasttitle . ‘</a>.’;
}
$extra = $extra . ‘</p>’;
}
$extra = $extra . ‘</div> <!– end of series stuff –>’;
} // End of Summary posts series code
} // End of what to do if series has several links

$content = $original_content . $extra;
endif; // End of series code

return $content;
}

add_filter(‘the_content’, ‘mrk_theme_article_footer’,0);[/php]