• Resolved mikelbyl

    (@mikelbyl)


    Just wondering if anyone has tips on how to display the caption on a featured image, if there is one.

    I’m using the grid loop plugin only on my custom taxonomies including only images. Consequently, I’m only displaying teasers and I’ve set it up so it’s only using the featured image (not the attachment posts) so that I can display these archives using uniform 300×300 images.

    But I can’t get the image caption to appear using any of the techniques I’ve read and so I am reaching out to the community for help.

    https://www.ads-software.com/plugins/genesis-grid-loop/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    The featured image caption can be retrieved using get_post( get_post_thumbnail_id() )->post_excerpt . More information: https://www.billerickson.net/wordpress-featured-image-captions/

    If you’re using the default Genesis function for displaying the featured image, you’ll need to remove it and create your own function so that you can add the above code to it.

    Thread Starter mikelbyl

    (@mikelbyl)

    Thanks Bill. I still have a lot of questions but I suppose these are beyond the scope of your support for this awesome plugin.

    I imagine that I’d want to create a conditional function in functions.php (to only act in the correct context), and if the condition is met, use the alternate method of posting the thumbnail/featured image. So I will go and find the existing code to post thumbnails in Genesis and conditionally remove_action for that and add_action with the new code.

    Am I on the right track?

    Plugin Author Bill Erickson

    (@billerickson)

    Yep. The Genesis function is in /lib/structure/post.php, genesis_do_post_image().

    In your conditional function, you can use this:

    if( apply_filters( 'is_genesis_grid_loop', false ) ) { // do stuff in the grid loop }

    If you’re in the grid loop, it will return true. If you’re not (or if the plugin is disabled) it will return false.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Captions on featured images?’ is closed to new replies.