Any way to use description instead of caption? (2 posts)

  1. sgpark
    Posted 2 years ago #

    I was wondering whether there is any way to replace the caption with the image description value.


  2. Steph
    Posted 2 years ago #

    The fotorama WordPress plugin uses the output of the gallery_shortcode() function which is the handler for the [gallery] shortcode. That function has a filter post_gallery which allows you to override the entire output. I think this about the only way to make any customisations of that sort as fotorama uses the output of that function, once each for the thumbnails and main images.

    You can copy the entire function from \wp-includes\media.php, rename it and hook it to that filter. Make sure you take out the following code in your copied function which is on line 783-786:

    // Allow plugins/themes to override the default gallery template.
    $output = apply_filters('post_gallery', '', $attr);
    if ( $output != '' )
    		return $output;

    I haven't got time to write your solution however a quick look tells me that on line 879, the caption uses $attachment->post_excerpt. You could change this to whatever you like. That should do it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Fotorama
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.