PHP Snippet to Remove Element based on URL

Here is a PHP snippet to remove an image or element on a specific (part) of a URL. This will grab the 1st url directory under the root.

[php]
<?php
$uri = $_SERVER["REQUEST_URI"];
$uri_array = split("/",$uri);
$uri_first = $uri_array[1]; // might need to change this to [1]
?>

<?php if ($uri_first == ‘urlafterfirstslash’){ ?>

<style>
#node-blog-2136 > div.content.clearfix > div.field.field-name-field-image.field-type-image.field-label-hidden > div > div > img {
display: none;
}
</style>

<?php } ?>
[/php]




Comments

Leave a Reply

Your email address will not be published. Required fields are marked *