Skip to content

Instantly share code, notes, and snippets.

@verticalgrain
Last active August 29, 2015 14:16
Show Gist options
  • Save verticalgrain/f8a0d0f515ecf3c32df2 to your computer and use it in GitHub Desktop.
Save verticalgrain/f8a0d0f515ecf3c32df2 to your computer and use it in GitHub Desktop.
Sublime snippet - ACF image
<!-- Sublime text snippet for calling an advanced custom fields image in a Wordpress theme file -->
<snippet>
<content><![CDATA[
<?php \$image = get_field('${1:acf_field_id}');
if( !empty(\$image) ): ?>
<img src="<?php echo \$image['sizes']['${2:thumbnail}']; ?>" alt="<?php echo \$image['title']; ?>" />
<?php endif; ?>
$0
]]></content>
<tabTrigger>image</tabTrigger>
<!-- <scope>source.php</scope> -->
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment