WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Colorbox
Use Caption Field instead of Title and Size? (5 posts)

  1. technabob
    Member
    Posted 1 year ago #

    is there any way to make JQuery Colorbox use the text that's in the Image Caption field instead of the Title and image size? That would seem more appropriate for most workflows.

    http://wordpress.org/extend/plugins/jquery-colorbox/

  2. techotronic
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    the title attribute of the image tag is used for the Colorbox.
    Your theme implements which text is put into that attribute.

    When you upload images, there are three fields that you can put text into, most probably your theme takes the contents of one of these fields.

    My plugin can't use the caption since every theme works differently and there is no generic way to determine where the text is rendered.

    Cheers,
    Arne

  3. technabob
    Member
    Posted 1 year ago #

    Ah, that makes sense now. It's probably my SEO plugin that's causing the funky titles then. I'll see if I can do something to change those settings.

  4. kriszani
    Member
    Posted 1 year ago #

    Sorry to hijack your thread, but I just had the same problem. I resolved it adding a filter into my functions.php file.

    if (!is_admin() && $GLOBALS["pagenow"] != "wp-login.php") {
    add_filter('wp_get_attachment_image_attributes', 'filter_image_title', 10, 2);
    }
    function filter_image_title($attr, $attachment = null){
    	$attr['title'] = $attachment->post_excerpt;
    	return $attr;
    }

    techotronic - I've seen quite a lot of people asking for this, couldnt you add a setting in your plugin that does the same thing and gives users the choice of what to display? I did have a little look at your source code but it would take a lot of trial and error for me to understand the way it all ties together.

    thanks for the plugin though! :-)

  5. techotronic
    Member
    Plugin Author

    Posted 1 year ago #

    Hi @kriszani

    Thanks for the code snippet.

    wp_get_attachment_image_attributes seems only to be used on image attachment pages in the themes that I looked at (if at all), so it's probably not something that I'd put into the plugin.

    Cheers,
    Arne

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags