Skip to content

Instantly share code, notes, and snippets.

@btribouillet
Last active June 14, 2017 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btribouillet/50ee6f5373061ac27348313d3e013692 to your computer and use it in GitHub Desktop.
Save btribouillet/50ee6f5373061ac27348313d3e013692 to your computer and use it in GitHub Desktop.
get imgix function
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