Skip to content

Instantly share code, notes, and snippets.

@vajrasar
Created July 2, 2015 10:20
Show Gist options
  • Select an option

  • Save vajrasar/20eb59b71880589f47c6 to your computer and use it in GitHub Desktop.

Select an option

Save vajrasar/20eb59b71880589f47c6 to your computer and use it in GitHub Desktop.
Using ACF for taxonomy images.
<?php
$prod_cats = get_terms( 'product_cat', 'hide_empty=0' );
?>
<ul class="gk-special-menu">
<?php
foreach( $prod_cats as $cat ){
$name = $cat->name;
$prod_term_link = get_term_link( $cat );
$img_obj = get_field( 'product_cat_img', 'product_cat_'.$cat->term_id );
?>
<li data-scroll-reveal="enter bottom over .25s after .5s">
<h4><?php echo $name; ?></h4>
<a href="<?php echo $prod_term_link; ?>">
<img class="alignnone size-full wp-image-974" src="<?php echo $img_obj['url']; ?>" width="185" height="256" />
</a>
</li>
<?php
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment