Created
March 18, 2017 11:46
-
-
Save gleddy/0f935d351c318a52b8dedddef213be3d to your computer and use it in GitHub Desktop.
cookbook snippet
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
// customize single post header content for dx5 | |
add_action( 'genesis_entry_header', 'dx5_do_post_header'); | |
function dx5_do_post_header() { | |
genesis_markup( array( | |
'html5' => '<header %s>', | |
'context' => 'dx5-post-heading', | |
) ); | |
// find featured image for post | |
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "full")[0]; | |
$tag_list = get_the_tag_list( '<ul><li>','</li><li>','</li></ul>' ); | |
// Added in content | |
echo '<div class="dx5-post-heading clearfix"> | |
<div class="dx5-post-feature-image dx5-left"><img src="'. $img .'" /></div> | |
<div class="dx5-post-title-info dx5-right"> | |
<h1>'. get_the_title() .'</h1> | |
<h2>'. get_the_excerpt() .'</h2> | |
<div class="tags">Tags: '. $tag_list .'</div> | |
<div class="cookbook-recipe-times">'.dx5_all_recipe_prep_times() .'</div> | |
</div> | |
</div>'; | |
genesis_structural_wrap( 'header' ); | |
} | |
remove_action( 'cookbook_recipe_top', 'cookbook_recipe_time', 12 ); | |
function dx5_all_recipe_prep_times( $recipe ) { | |
$recipe_ids = cookbook_get_embedded_recipe_ids(); | |
if ( empty( $recipe_ids ) ) { | |
return; | |
} | |
foreach ( $recipe_ids as $recipe_id ) { | |
$recipe = cookbook_get_recipe( $recipe_id ); | |
if ( $recipe ) { | |
echo cookbook_template_prep_time($recipe) . cookbook_template_cook_time($recipe) . cookbook_template_total_time($recipe); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment