Home>Support>image description in attachment page

image description in attachment page

Hi,
I want the attachment pages of images to display the description field. How can I do that? Maybe by customising the image.php in my child theme?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Hi :)

    Sure. Are you using a child theme? If so you can make a copy of image.php and move into the child theme folder. Then, you can insert:

    <?php $description = $post->post_content; ?>
    <div class="attachment-description">
    <?php echo $description; ?>
    </div>
    

    Ref: http://www.wpbeginner.com/wp-tutorials/image-meta-data-101-title-caption-alt-text-and-description/.

    You can insert the above on line 54 after:

    </div><!-- .entry-attachment -->
    
  2. 8 years, 10 months ago phil_traveler

    It work! Thanks a lot. Is it possible to customize font size of description?

  3. 8 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Super :) Try:

    /* Image attachment page description */
    
    .attachment-description {
    font-size: 14px;
    padding-top: 10px;
    padding-bottom: 10px;
    }
    

    Etc. Insert the above at Appearance > Custom CSS and edit as required. If there are any issues with this, please, send a link to a image attachment page so I can inspect it live.

    Thanks :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More