Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save srikat/ba7a490dfb9e44186ec1 to your computer and use it in GitHub Desktop.

Select an option

Save srikat/ba7a490dfb9e44186ec1 to your computer and use it in GitHub Desktop.
Displaying Featured Image above Post Titles regardless of Content Archives settings in Genesis
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before_entry', 'sk_featured_image_above_title' );
/**
* Display Featured Image above Post Titles regardless of Content Archives settings
*
* Scope: Posts page (Blog)
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/display-featured-images-post-titles-posts-page-genesis/
*/
function sk_featured_image_above_title() {
if ( ! is_home() ) {
return;
}
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'sk_featured_image', 9 );
}
function sk_featured_image() {
echo '<a href="' . get_permalink() . '">' . genesis_get_image( array( 'size' => 'full' ) ). '</a>';
}
echo '<a href="' . get_permalink() . '">' . genesis_get_image( array( 'size' => 'full' ) ). '</a>';
echo '<a href="' . get_permalink() . '">';
if( FALSE === genesis_image( array( 'size' => 'full' ) ) ) {
echo '<img src="'. get_stylesheet_directory_uri() .'/images/default-image.gif" />';
}
.home .content .entry-title {
margin-top: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment