WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. sgpark
    Member
    Posted 6 months ago #

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

    http://wordpress.org/plugins/fotorama/

  2. Steph
    Member
    Posted 4 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.