• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Wellness Pro – Display Featured Image Caption in Posts

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Wellness Pro – Display Featured Image Caption in Posts

This topic is: not resolved

Tagged: featured image, hooks, php, posts

  • This topic has 2 replies, 2 voices, and was last updated 2 years, 5 months ago by abails06.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • September 30, 2020 at 1:43 pm #501267
    abails06
    Participant

    Hi all,

    The wellness pro theme displays the featured image as the default image at the top of individual blog posts which I like. However, I can't figure out how to get it to display the caption that I put in when I upload the image underneath. Does anyone have a solution to this issue?

    I'm currently building the site locally, so I can't link to the live site, but the post linked is what it looks like.

    Thanks!

    Adam

    https://demo.studiopress.com/wellness/how-to-get-started-with-greenhouse-gardening/
    September 30, 2020 at 3:39 pm #501268
    Anita
    Keymaster

    I don't see anything in the demo that would prevent the caption from displaying in the demo CSS. Without see your particular website it would be a bit difficult to help. Can you push it to a Live hosting environment? Then provide a link to a post with the caption?


    Love coffee, chocolate and my Bella!

    September 30, 2020 at 3:49 pm #501269
    abails06
    Participant

    Thanks for the response. I should have been more clear in my question. Is there additional php I can add to this code in functions.php to get it to automatically display the caption associated with the image when I imported it. If I can also assign it the alt tag associated with the uploaded image and not the post title, that would also be helpful, but more of a minor issue.

    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 );
    		}
    	}
    
    }
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble