Skip to content

Instantly share code, notes, and snippets.

@moxdev
Created March 6, 2019 15:24
Show Gist options
  • Save moxdev/ce676f8b3f915f5227613a812f93bf13 to your computer and use it in GitHub Desktop.
Save moxdev/ce676f8b3f915f5227613a812f93bf13 to your computer and use it in GitHub Desktop.
Srcset Custom Wordpress #wp
<img src="<?php echo esc_url( $sm_img ); ?>" alt="<?php echo esc_attr( $alt ); ?>"
srcset="
<?php echo esc_url( get_the_post_thumbnail_url( get_the_ID(), 'listing-thumb-sm' ) ); ?> 250w,
<?php echo esc_url( get_the_post_thumbnail_url( get_the_ID(), 'listing-thumb-md' ) ); ?> 550w,
<?php echo esc_url( get_the_post_thumbnail_url( get_the_ID(), 'listing-thumb-lg' ) ); ?> 850w,
<?php echo esc_url( get_the_post_thumbnail_url( get_the_ID(), 'listing-thumb-xlg' ) ); ?> 1150w">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment