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.

$uri_array = split("/",$uri);
$uri_first = $uri_array[1]; // might need to change this to [1]

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

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

<?php } ?>


Leave a Reply

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