Problem: We need to hide joomla plugin like sharethis social buttons only on some pages, we don't need to show that plugin on simple layout article only on blog types
Solution:
1. Download plugin file from folder: plugins/content/sharethis.php
2. Add a function to read the base url where the plugin is loaded on the start of the file, just after ?php line.
----------
...
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;
}
...
----------
3.- Now we need to create a condition for only display the plugin where the url contain string "layout=blog", see url sample:
index.php?option=com_content&view=category&layout=blog&id=19&Itemid=12
4.- We end our piece of code adding the condition if we found a substring "layout-blog" inside the base url, see the code in green with our modiifcation on sharethis.php plugin.
----------
...
$url = curPageURL();
if (strpos($url,'layout=blog')) {
/* Return whole button style code with article title and article url values. */
$url = JURI::root().ContentHelperRoute::getArticleRoute($article->id, $article->catid);
return "<DIV style='text-align:".$this->_alignment.";padding-bottom:30px;padding-top:10px'>".$this->showWidget().$this->getWidgetStyle($url,$article->title)."</DIV>";
}
else
{
/* that the code to return to function when the condition is tru on lyout=blog
return "<DIV id='hidden'></DIV>";
}
...
----------
That's all folks ;-)