php - disable preg_replace() for some images... -


i using function replace data-rel , add hyperlink images of content.

function add_image_responsive_class($content) {    global $post;      $pattern ="~<img(.*?)class=\"(.*?)\"(.*?)src=\"(.*?)\"(.*?)>~i";    $replacement = '<a href="$4" data-rel="lightbox-gallery"><img$1class="$2"$3src="$4"$5></a>';    $content = preg_replace($pattern, $replacement, $content);    return $content; } add_filter( 'the_content', 'add_image_responsive_class'); 

its working awesome, there 1 issue facing now. time want add images have different links. example want add logos link websites. opening same image because of preg_replace() function.

is there way disable images somehow? cant use link media file every image, that's why using function. please me!


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -