Community Forums › Forums › Archived Forums › General Discussion › Eleven40 Pro: Show featured image – How to
- This topic has 8 replies, 5 voices, and was last updated 11 years, 9 months ago by
guitardaddy180.
-
AuthorPosts
-
December 24, 2013 at 10:23 am #81074
mmjaeger
MemberHello
How can I show the featured image on the single-post page using the Eleven40 Pro theme.
Thank you in advance for your help.
December 24, 2013 at 10:48 am #81078Genesis Developer
MemberTry to add this code in functions.php file
add_action( 'genesis_entry_content', 'genesis_do_single_post_image', 8 ); add_action( 'genesis_post_content', 'genesis_do_single_post_image' ); function genesis_do_single_post_image() { if ( is_single() ) { $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'context' => 'archive', 'attr' => genesis_parse_attr( 'entry-image' ), ) ); if ( ! empty( $img ) ) printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img ); } }
January 9, 2014 at 3:15 pm #84250corbinl
MemberThanks for this -- it displayed for me! But now, it's left-aligned for all entries, which sometimes pushes the text all over.
Is there an easy way to top-align it, so the singlepost featured image is above the title, such as with Streamline and some other themes? Thanks for your help.
--
Best regards,
CorbinJanuary 9, 2014 at 9:42 pm #84299Genesis Developer
MemberOk. Then remove this two lines
add_action( 'genesis_entry_content', 'genesis_do_single_post_image', 8 ); add_action( 'genesis_post_content', 'genesis_do_single_post_image' );And add this two lines
add_action( 'genesis_entry_header', 'genesis_do_single_post_image' ); // this is for HTML5 hook
add_action( 'genesis_before_post_title', 'genesis_do_single_post_image' ); // Thi sis for Pre-HTML5 hookalso you want a full width image then change this line
'size' => genesis_get_option( 'image_size' ),to'size' => 'full',
January 10, 2014 at 5:05 am #84342January 30, 2014 at 10:39 am #87835jlph
ParticipantIs there something I can add to this code to have the featured image appear in the posts on the homepage as well, instead of just the archive?
March 2, 2014 at 11:50 am #93074guitardaddy180
MemberHow do we align the image to the right hand side then?
Thanks for your response!
March 2, 2014 at 12:01 pm #93076Genesis Developer
MemberTry this code once
function featured_image_right_alignment( $attributes ) { $attributes['class'] = str_replace( 'alignleft', 'alignright', $attributes['class'] ); return $attributes; } add_filter( 'genesis_attr_entry-image', 'featured_image_right_alignment' );
March 2, 2014 at 1:10 pm #93084guitardaddy180
Membergenrock! Thank You again!!!!!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.