The other day I added digg dugg to my list of plugins. Its pretty cool I like it. I was looking at a way of pulling in some related material to tag on to the bottom of my blog posts. I wanted to be able to plugin a keyword and pull posts from somewhere based upon whatever that word was. I looked at the digg duggplugin and thought cool, that might well work.
I couldn’t see a way of adding db variables straight off the bat into the digg dugg function, so after a little bit of fannying around with single.php I came up with this approach. (I may have missed something and wasted the past hour or so doing this, but what the hey, it works, Im happy)
If you want to display upcoming digg posts using the 1st tag that you used for your blog post. Then here is how you can do it.
After installing and activating the digg dugg plugin.
Pull out single.php from your wordpress blog theme.
In between the comments_template() and the endwhile lines place the code as shown.
[php]
comments_template();
function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
$mytags= get_the_category_list($separator, $parents);
$mystring = get_string_between($mytags, '">‘, ‘‘);
$mystring=strip_tags($mystring);
echo”Top 5 upcoming $mystring related Digg Stories”;
dd_diggdugg(”, 5, 1, $mystring, ‘upcoming’);
endwhile; ?>
[/php]
Save it, upload it. Thats it. Done.
Your posts will now fetch the last 5 or whatever number you wish to specify upcoming posts relative to the 1st word you used to tag your original post.
Optional. You could also edit the digg dugg plugin which incidently has a bunch of cool features. and add the nofollow link option. In diggdugg.php just look for instances of a href type links and add rel=nofollow inside the tags.
