How to say to WordPress to use caption media library in a gallery?

No one of a “top 5” plugins that I try, use the image-captions of the media library

How to setup WordPress (or plugins) to use/reuse this standard caption?

Read More

Media library standard caption is the caption in the standard interface:

After you select Edit in List View (or select the image in Grid View) the Edit Media page will load, allowing you to change the default Title, Alternate Text, Caption, and Attachment Page Content

Related posts

2 comments

  1. If that caption is a metafield or st that can be queried by id; maybe some of the plugins have filter/action (or add one?) that can manipulate title to be whatever you like?

  2. Modify whatever plugin you are currently using to add custom code like below. Note, we will have to make adjustment to below code as per the plugin. This is just an example :

    <?php
        $args = array( 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'numberposts' => null, 'post_parent' => $post->ID );
    
        $attachments = get_posts($args);
        if ($attachments) {
            foreach ( $attachments as $attachment ) {
              $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
              $image_title = $attachment->post_title;
              $caption = $attachment->post_excerpt;
              $description = $image->post_content;
    ?>
            <a href="<?php echo wp_get_attachment_url( $attachment->ID); ?>" rel="lightbox" title="<?php echo $image_title; ?>"><img src="<?php echo get_bloginfo('template_directory'); ?>/yourfile.php?h=75&w=75&zc=1&src=<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" alt="<?php echo $alt; ?>" width="75" height="75" border="0" /></a>
     <?php } } ?>
    

    Edit 1: Let us take Photo-Gallery Plugin as the example and try to see what are the options we have to implement changes to reflect your desire result. The above plugin is based on Model View Controller. Also when you install the plugin, it creates own set up tables to maintain info about the Gallery, Theme, Images etc.

    So the one better option to start with could be, you made your changes in the respective frontend model and view frontend/models/BWGModelSlideshow.php. I recommend you give special attention to the method public function get_image_rows_data($id, $sort_by, $order_by = 'asc', $bwg) in the above model.

    And also go through the table structure for the bwg_image in photo-gallery/photo-gallery.php before you plan your actual implementation.

Comments are closed.