Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active April 17, 2018 19:45
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 billerickson/55ea48adc7622bdd0fd25d747c928abe to your computer and use it in GitHub Desktop.
Save billerickson/55ea48adc7622bdd0fd25d747c928abe to your computer and use it in GitHub Desktop.
<?php
/**
* Lamb Cuts
*
*/
function ea_recipe_lamb_cuts() {
$cuts = get_the_terms( get_the_ID(), 'lamb_cut' );
if( empty( $cuts ) || is_wp_error( $cuts ) )
return;
$classes = wp_list_pluck( $cuts, 'slug' );
$classes[] = 'lamb-cuts';
echo '<span class="' . join( ' ', $classes ) . '">' . ea_icon( 'lamb' ) . '</span>';
}
add_action( 'cookbook_recipe_top', 'ea_recipe_lamb_cuts' );
/**
* Display Icon
*
*/
function ea_icon( $slug = '' ) {
$icon_path = get_template_directory() . '/assets/icons/' . $slug . '.svg';
if( file_exists( $icon_path ) )
return file_get_contents( $icon_path );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment