0
votes

I am trying to insert code into my wordpress themes single portfolio file, to display the titles or descriptions of portfolio images.

My theme uses Jetpack Portfolios and the file content-single-portfolio is where a gallery of images is called for single projects.

<?php
        $images = get_post_meta($post->ID, 'vdw_gallery_id', true);

        if ($images) {
            foreach ($images as $image) {
                echo '<div class="portfolio-item portfolio-image-wrapper">';
                //echo wp_get_attachment_link($image, 'large');
                    echo '<div class="portfolio-image">';
                        echo wp_get_attachment_image($image, 'full');
                        echo $image_caption;

                    echo '</div>';
                echo '</div>';
            }
        }

So yeah, how would I go about tweaking this, what would I add so that the image titles show up underneath the images?

1

1 Answers

0
votes

OK, so I'm not very adept in jQuery, but I solved it or, at least, found a way for it to work for me. I just added in two divs calling the title/caption of the image, then styled the divs to shower on hover.

echo '<div class="portfolio-image">';

                    echo wp_get_attachment_image($image, 'full');

                    echo '<div class="portfolio-image-title">';
                        echo get_the_title($image);
                    echo '</div>';

                    echo '<div class="portfolio-image-caption">';
                        echo wp_get_attachment_caption($image);
                    echo '</div>';