• Resolved excentricjester

    (@excentricjester)


    Hi,

    Is it possible to have captions on, but not have them fallback to the title if they’re blank? Until I have captions for every image I’d rather it didn’t display the weird file names.

    So far I’m enjoying how simple the plugin has been to use ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Philipp Bammes

    (@tyrannous)

    Hi @excentricjester,
    there’s a filter called slick_slider_caption_html (see FAQ section) which you can use to adjust the caption text to whatever you want.

    You may use something like the following to achieve your goal.

    add_filter( 'slick_slider_caption_html', function( $caption_text, $attachment_id, $post_id ) {
    	return apply_filters( 'the_excerpt', get_post_field( 'post_excerpt', $attachment_id ) );
    }, 10, 3 );
    • This reply was modified 7 years, 9 months ago by Philipp Bammes.
    • This reply was modified 7 years, 9 months ago by Philipp Bammes. Reason: Improved logic
    Thread Starter excentricjester

    (@excentricjester)

    Thanks, that does exactly what I want!

    Plugin Author Philipp Bammes

    (@tyrannous)

    Glad it’s working for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Don’t fallback to title if caption is blank’ is closed to new replies.