-
-
Save billerickson/55ea48adc7622bdd0fd25d747c928abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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