Last active
August 29, 2015 14:07
-
-
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
This file contains hidden or 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_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>'; | |
| } |
This file contains hidden or 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
| echo '<a href="' . get_permalink() . '">' . genesis_get_image( array( 'size' => 'full' ) ). '</a>'; |
This file contains hidden or 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
| echo '<a href="' . get_permalink() . '">'; | |
| if( FALSE === genesis_image( array( 'size' => 'full' ) ) ) { | |
| echo '<img src="'. get_stylesheet_directory_uri() .'/images/default-image.gif" />'; | |
| } |
This file contains hidden or 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
| .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