Last active
September 22, 2017 11:34
-
-
Save aabergkvist/d727816d48c6b5cbbf9c to your computer and use it in GitHub Desktop.
Lägg till entry image före title
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 | |
//* Do NOT include the opening php tag | |
//* Add entry image before entry title | |
add_action( 'genesis_entry_header', 'ab_entry_image', 1 ); | |
function ab_entry_image() { | |
if ( is_page() || ! genesis_get_option( 'content_archive_thumbnail' ) ) | |
return; | |
if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'entry-image' ) ) ) ) { | |
printf( '<a href="%s" rel="bookmark"><img class="aligncenter entry-image" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment