Last active
August 29, 2015 14:10
-
-
Save DMSpeed/75f232ee333ee7609545 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
/** Add post image above post title */ | |
add_action( 'genesis_before_post_title', 'decor_post_image' ); | |
function decor_post_image() { | |
if ( is_page() ) return; | |
else | |
if( in_array( 'teaser', get_post_class() ) && $image = genesis_get_image( 'format=url&size=grid-image' )) | |
{printf( '<a href="%s" rel="bookmark" class="post-photo"><span class="grid-date">%s</span><img src="%s" alt="%s" /></a>', get_permalink(), do_shortcode( '<em>[post_date format="j"]</em>[post_date format="F Y"]' ), $image, the_title_attribute( 'echo=0' ) ); | |
} | |
else | |
if( in_array( 'feature', get_post_class() ) && $image = genesis_get_image( 'format=url&size=post-image' )) | |
{printf( '<a href="%s" rel="bookmark" class="post-photo"><span class="post-date">%s</span><img src="%s" alt="%s" /></a>', get_permalink(), do_shortcode( '<em>[post_date format="j"]</em>[post_date format="F Y"]' ), $image, the_title_attribute( 'echo=0' ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This creates a grid loop on the homepage of a site using the Decor theme, and shows the featured image above the post title.