• Resolved eikebaran

    (@eikebaran)


    Hi!

    First of all thank you for your very handy plugin. At the moment I’m working on a page where i want to put a big slideshow of the most recent posts into the header-section. In Addition to their featured image i would like to display the posts title. But if i select the captions=”yes”-option for the su_image_carousel no Post-title is shown. I’ve tracked it down and noticed that in /includes/functions-galleries.php line 283:

    
     $attachment_id = 'media' === $source['type'] || 'attachment' === $post->post_type
                            ? $post->ID
                            : get_post_thumbnail_id( $post->ID );
    /*...*/
    
    $slide = array(
    'attachment_id' => $attachment_id,
    'caption'       => trim( wp_get_attachment_caption( $attachment_id ) ),
    );
    

    The caption is set to the attachments caption even if the post has its own caption – which i assume most of the time is the caption the user wants to see in that post-slider. I fixed it up locally as follows by removing the cited lines above and putting this right in the foreach-block at line 273. This was just a quick fix, i dunno if this breaks something elsewhere, especially if the if-clause is fishes for the the correct source-types.

    		
    $slide=array();
    
    if('media' === $source['type'] || 'attachment' === $post->post_type){
    	$slide['attachment_id']=$post->ID;
    	$slide['caption']=trim( wp_get_attachment_caption( $slide['attachment_id'] ));
    }else{
    	$slide['attachment_id']= get_post_thumbnail_id( $post->ID );
    	$slide['caption']=get_the_title($post->ID);
    }
    

    Would be nice if this would be fixed in future versions.

    Bye,

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘su_image_carousel Title missing for posts’ is closed to new replies.