Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Carl Sergile
Carl Sergile
16,570 Points

Overlay over featured image WordPress

Hey guys, So I'm in the final stretch of my portfolio site and I am stuck on creating an overlay for my featured image which would display the content over it. I have tried something like this: https://css-tricks.com/slide-in-image-captions/ but the only thing is the figure tag doesn't seem to 'contain' the image and is too wide, so the overlay seems to slide in to the right of the image and not over it.

My php code:

if ( has_post_thumbnail() ) {

            echo '<figure>';
            echo '<img src="';
            echo $thumbnail_id_three;
            echo '"alt="test" />';
            echo '<figcaption>Testing</figcaption>';
            echo '</figure>';

?>

     <?php

} ?> *Side Note $thumbnail_id_three contains the image***

Not the prettiest of code but pretty much trying to find out how to make the figure tag contain the image so it fits the image.

Let me know if I need to be more clear in what I'm trying to do. Thanks!!!!!