Skip to content

Instantly share code, notes, and snippets.

@gleddy
Created March 18, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gleddy/0f935d351c318a52b8dedddef213be3d to your computer and use it in GitHub Desktop.
Save gleddy/0f935d351c318a52b8dedddef213be3d to your computer and use it in GitHub Desktop.
cookbook snippet
// 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