Skip to content

Instantly share code, notes, and snippets.

@aabergkvist
Last active September 22, 2017 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aabergkvist/d727816d48c6b5cbbf9c to your computer and use it in GitHub Desktop.
Save aabergkvist/d727816d48c6b5cbbf9c to your computer and use it in GitHub Desktop.
Lägg till entry image före title
<?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