-
-
Save robneu/d038b22bb10d210a7d7cb896f0e4bcfd 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_get_recipe_times() .'</div> | |
</div> | |
</div>'; | |
genesis_structural_wrap( 'header' ); | |
} | |
remove_action( 'cookbook_recipe_top', 'cookbook_recipe_time', 12 ); | |
function dx5_get_recipe_times() { | |
$recipe_ids = cookbook_get_embedded_recipe_ids(); | |
if ( empty( $recipe_ids ) ) { | |
return; | |
} | |
$output = ''; | |
foreach ( $recipe_ids as $recipe_id ) { | |
$recipe = cookbook_get_recipe( $recipe_id ); | |
if ( $recipe ) { | |
$output .= cookbook_get_prep_time_html( $recipe, $recipe->prep_time() ); | |
$output .= cookbook_get_cook_time_html( $recipe, $recipe->cook_time() ); | |
$output .= cookbook_get_total_time_html( $recipe, $recipe->total_time() ); | |
} | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment