Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Add Share This to functions.php */
- set_time_limit(20);
- ini_set("memory_limit","128M");
- function jw_share_this_links($content) {
- $id = get_the_ID();
- $title = get_the_title($id);
- $url = get_permalink($id);
- //get image path
- $img_path = get_template_directory_uri() .'/images/';
- $content .= "\n";
- $content .= "<div class=\"jwsharethis\">\n";
- $content .= "Share this: \n";
- $content .= "<br />\n";
- $content .= "<a href=\"mailto:?subject=" . rawurlencode($title) . "&body=" . rawurlencode($url) . "\">\n";
- $content .= "<img src=\"" .$img_path. 'email.png' ."\" alt=\"Share this page via Email\" />\n";
- $content .= "</a>\n";
- $content .= "<a target=\"_blank\" href=\"http://www.stumbleupon.com/submit?url=" . urlencode($url) . "&title=" . urlencode($title) . "\">\n";
- $content .= "<img src=\"" .$img_path .'su.png' ."\" alt=\"Share this page via Stumble Upon\" />\n";
- $content .= "</a>\n";
- $content .= "<a target=\"_blank\" href=\"http://digg.com/submit?url=" . urlencode($url) . "&title=" . urlencode($title) . "\">\n";
- $content .= "<img src=\"" .$img_path .'digg.png' ."\" alt=\"Share this page via Digg this\" />\n";
- $content .= "</a>\n";
- $content .= "<a target=\"_blank\" href=\"http://www.facebook.com/sharer.php?u=" . urlencode($url) . "&t=" . urlencode($title) . "\">\n";
- $content .= "<img src=\"" .$img_path .'fb.png' ."\" alt=\"Share this page via Facebook\" />\n";
- $content .= "</a>\n";
- // $content .= "<a target=\"_blank\" href=\"http://twitter.com/home?status=I+like+" . urlencode($url) . "&title=" . urlencode($title) . "\">\n";
- $content .= "<a target=\"_blank\" href=\"http://twitter.com/intent/tweet?text=I+like+" . urlencode($url) . "&title=" . urlencode($title) . "\">\n";
- $content .= "<img src=\"" .$img_path .'twitter.png' ."\" alt=\"Share this page via Twitter\" />\n";
- $content .= "</a>\n";
- $content .= "</div>\n";
- return $content;
- }
- add_filter('the_content', 'jw_share_this_links');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement