Skip to content

Commit

Permalink
Content filter: Bail early if srcset present.
Browse files Browse the repository at this point in the history
  • Loading branch information
joemcgill committed Sep 20, 2015
1 parent b5b0484 commit 5c90df8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wp-tevko-responsive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ function _tevkori_filter_content_images_callback( $image ) {
list( $image_html, $atts ) = $image;
$id = $size = false;

// Bail early if a `srcset` attribute already exists.
if ( ! strpos( $atts, 'srcset=' ) ) {
return $image_html;
}

// Grab ID and size info from core classes.
if ( preg_match( '/wp-image-([0-9]+)/i', $atts, $class_id ) ) {
(int) $id = $class_id[1];
Expand Down

0 comments on commit 5c90df8

Please sign in to comment.