Created
April 8, 2015 23:13
-
-
Save webmasterninjay/28de13e6858dd387d4a3 to your computer and use it in GitHub Desktop.
Wordpress Genesis: Add featured image conditionally
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 | |
//* Auto post image | |
add_action( 'genesis_entry_header', 'advance_post_featured_image', 15 ); | |
function advance_post_featured_image() { | |
if ( is_archive() ) | |
return; | |
if ( 'project' == get_post_type() ){ | |
$img = genesis_get_image( array( 'format' => 'html', 'size' => 'large', 'attr' => array( 'class' => 'post-image aligncenter' ) ) ); | |
printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img ); | |
} | |
else { | |
$img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image alignleft' ) ) ); | |
printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment