Recently we have made the TheGreatQuotes.com SEO friendly. And, this site has started getting organic traffic from search engines as we are making it SEO friendly.
And, we are using "Social Bookmarks" Wordpress plug-in for showing buttons which are useful for sharing the web page with Social Bookmarking Sites.
This Social Bookmarks plug-in works fine for the standard posts in this site. But it didn't work properly for custom pages after implementing SEO friendly URLs. Sharing of the individual Quotes showing page ( example page) didn't work.
Today I have fixed this issue by editing the social_view_public.php page of the plug-in.
Previously it was using $permalink variable for passing as URL into the social bookmarking sites. Since we introduced SEO friendly mod rewrites, it was NOT passing the URL correctly.
So, I updated the code to use current page url instead of using $permalink variable.
Replaced the $permalink at below statement in get_social_bookmark function with the value returned from curPageURL()
$target_href = str_replace('{link}', $permalink, $target_href);
curPageURL() function is defined as below.
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
Let me know if you still see any issues while sharing the Quotes thro' the Social bookmarking sites.
No comments:
Post a Comment