Community Forums › Forums › Archived Forums › Design Tips and Tricks › Featured Image Text Overlay
Tagged: featured image, image hover, image overlay, text overlay
- This topic has 8 replies, 2 voices, and was last updated 6 years, 9 months ago by Brad Dalton.
-
AuthorPosts
-
March 9, 2018 at 4:54 pm #217634Breezii K.Member
Hello,
Am using the Wellness Pro child theme on the genesis framework with the latest version of wordpress. Am wondering if there was any way to custom code the featured image so it displays a different custom caption for each featured image on the post page?
If not possible, is anyone aware of a plugin that can do this that is compatible with studiopress themes?
Thank you!
- Bree
http://mybreality.comMarch 10, 2018 at 12:32 am #217692Brad DaltonParticipantMarch 10, 2018 at 2:05 am #217699Breezii K.MemberHello,
Thank you for the response. I tried that plugin along with about 8 others and nothing seems to have worked for me, as far as I can tell.
I did find this article, however;
https://napitwptech.com/tutorial/wordpress-development/display-image-caption-added-wordpress/...and am wondering if perhaps this method could work with the Genesis framework and Wellness Pro child theme I am using.
If so, they first suggest this-
For the display of the image caption under the featured image, you first have to know that which file is rendering the display of the featured image in your site.
So I wonder where exactly in my files might the featured image be 'rendering to display'? 🙂
March 10, 2018 at 2:26 am #217700Brad DaltonParticipantYou'll find the PHP code which adds the featured image in your child themes functions file.
March 10, 2018 at 10:12 am #217716Breezii K.MemberI tried looking for it there the other night but am not sure exactly where this snippet of code needs to go; is it somewhere in this section?
// Add featured image on single post.
add_action( 'genesis_entry_content', 'wellness_featured_image', 1 );
function wellness_featured_image() {$add_single_image = get_theme_mod( 'wellness_single_image_setting', true );
$image = genesis_get_image( array(
'format' => 'html',
'size' => 'featured-image-large',
'context' => '',
'attr' => array ( 'alt' => the_title_attribute( 'echo=0' ), 'class' => 'aligncenter' ),
) );if ( is_singular() && ( true === $add_single_image ) ) {
if ( $image ) {
printf( '<div class="featured-image">%s</div>', $image );
}
}}
// Modify size of the Gravatar in the author box.
March 10, 2018 at 10:16 am #217717Breezii K.MemberWHen I try to add the suggested code given from the article to the snippet of 'featured image' code found in my functions.php file (above) I see this error;
Your PHP code changes were rolled back due to an error on line 169 of file wp-content/themes/wellness-pro/wellness-pro/functions.php. Please fix and try saving again.
syntax error, unexpected '<'
March 10, 2018 at 10:23 am #217718Breezii K.MemberI think I may have to give up on this idea and try to find a different way of doing this perhaps. All I wanted to do was to show the Image Source Credit link on each of my featured images (but only on the post page and not the homepage).
I seem unable to figure it out, hmm.
March 10, 2018 at 10:24 am #217719Breezii K.MemberWas hoping the image caption section would do this but it's not appearing, and I am not the best at working with custom code - all the options I have tried thus far have failed.
March 11, 2018 at 10:29 pm #217801Brad DaltonParticipantThere's some work involved in this relating to PHP & CSS. I spent a few hours working on this example for a registered member.
The source of the overlay text can be added on single posts.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.