Skip to content

Instantly share code, notes, and snippets.

@besimhu
Created March 16, 2015 04:00
Show Gist options
  • Save besimhu/eaff17710834576017a1 to your computer and use it in GitHub Desktop.
Save besimhu/eaff17710834576017a1 to your computer and use it in GitHub Desktop.
/**
* Generate image markup through WP function.
*
* Requires ACF setting of ID.
* The crop can be custom, or one of WP default ones, or leave empty.
*
* This method does not work great with Media Query Sync. However, this method
* allows you to define custom settings, and the width, height, and alt tags will
* be auto generated for you. Which is great for semantics.
*
* wp_get_attachment_image( $attachment_id, $size, $icon, $attr );
* http://codex.wordpress.org/Function_Reference/wp_get_attachment_image
*/
<?php echo wp_get_attachment_image( $image_field, 'image_crop', '0', array('class' => '') ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment