Last active
June 14, 2017 09:18
-
-
Save btribouillet/50ee6f5373061ac27348313d3e013692 to your computer and use it in GitHub Desktop.
get imgix function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp_get_imgix_image( $attachment_id, $options = '' ) { | |
$url = ''; | |
$image = wp_get_attachment_image_src( $attachment_id ); | |
$imgix_bucket = get_option( 'imgix_bucket' ); | |
if($image && imgix_bucket) { | |
$url = $imgix_bucket.$image['url'].$options; | |
} | |
return $url; | |
} | |
// Examples | |
echo wp_get_imgix_image( get_post_thumbnail_id, 'w=1600&h=800' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment