Now it's time to expand our plugin with concrete functionality and add a Digg link to every post on our blog.
In order to create a link we will need to extract post's permalink URL, title, and description. Luckily, WordPress provides us with a variety of ways to do this.
Let's create a function to display a Digg submit link using information from the post.
Then we will implement this function into our theme, to show the link just after the post content.
Add a function to our plugin to display a Digg link:
/* Show a Digg This link */ function WPDiggThis_Link() { global $post; // get the URL to the post $link=urlencode(get_permalink($post->ID)); // get the post title $title=urlencode($post->post_title); // get first 350 characters of post and strip it off // HTML tags $text=urlencode(substr(strip_tags($post->post_content), 0, 350)); // create a Digg link and return it return '<a href="http://digg.com/submit?url=...