Title: Insert image description inside image.php
Last modified: April 22, 2021

---

# Insert image description inside image.php

 *  [wpsoup](https://wordpress.org/support/users/wpsoup/)
 * (@wpsoup)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/insert-image-description-inside-image-php/)
 * Hello. I would like to know if it’s possible to add the meta description from
   an image to the image attachment.
 * I tried to look at other themes such Koji and Eksell where descriptions are added
   with captions, but I’m not at all php expert and didn’t success.
 * Any ideas ?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Theme Author [Anders Norén](https://wordpress.org/support/users/anlino/)
 * (@anlino)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/insert-image-description-inside-image-php/#post-14355564)
 * Hi [@wpsoup](https://wordpress.org/support/users/wpsoup/),
 * It’s possible, but you’re going to have create a child theme and add the output
   of the caption by copying over the `singular.php` file to the child theme and
   modify it there. You can use this code to output the caption (copied from Eksell):
 *     ```
       <?php if ( $caption = get_the_post_thumbnail_caption() ) : ?>
       	<figcaption><?php echo $caption; ?></figcaption>
       <?php endif; ?>
       ```
   
 * You’ll probably need to add some styling to it as well.
 * — Anders
 *  Thread Starter [wpsoup](https://wordpress.org/support/users/wpsoup/)
 * (@wpsoup)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/insert-image-description-inside-image-php/#post-14356074)
 * Hello [@anlino](https://wordpress.org/support/users/anlino/). Thanks for your
   reply and thank you a lot for your great themes.
 * Your answer didn’t solve my problem but permits to progress.
 * In fact my aim was to add the description data from an image (not the caption
   data), when you opened it from a gallery post made by wordpress editor, which
   link to attachment page.
 * I don’t want bother you on how I concluded this but if I erase image.php from
   Fukasawa theme, description data from image attachment page appears by defaut.
 * So I add the following code to a child image.php and it works :
 *     ```
       <?php 
       if ( $post_format == 'video' && isset( $content_parts ) ) { 
       $content = $content_parts['extended'] ? $content_parts['extended'] : '';
       $content = apply_filters( 'the_content', $content );
       echo $content;
       } else {
       the_content();
       }
   
       if ( ! is_single() ) {
       edit_post_link( __( 'Edit post', 'fukasawa' ), '<p>', '</p>' );
       }
   
       ?>
       ```
   
 * I don’t know if I paste uncessary lines of code, but there is something inside
   this which missing inside Image.php to display description data.
    -  This reply was modified 5 years, 1 month ago by [wpsoup](https://wordpress.org/support/users/wpsoup/).
      Reason: page formatting

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Insert image description inside image.php’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/fukasawa/2.1.3/screenshot.jpg)
 * Fukasawa
 * [Support Threads](https://wordpress.org/support/theme/fukasawa/)
 * [Active Topics](https://wordpress.org/support/theme/fukasawa/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/fukasawa/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/fukasawa/reviews/)

## Tags

 * [attachment](https://wordpress.org/support/topic-tag/attachment/)
 * [image description](https://wordpress.org/support/topic-tag/image-description/)

 * 2 replies
 * 2 participants
 * Last reply from: [wpsoup](https://wordpress.org/support/users/wpsoup/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/insert-image-description-inside-image-php/#post-14356074)
 * Status: not resolved