Plugin Directory

Changeset 964749


Ignore:
Timestamp:
08/12/2014 07:44:33 PM (12 years ago)
Author:
LesBessant
Message:

Added support for gallery thumbnails

Location:
restore-image-title/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • restore-image-title/trunk/readme.txt

    r900371 r964749  
    33Tags: image, title
    44Requires at least: 3.5
    5 Tested up to: 3.9
    6 Stable tag: 1.1
     5Tested up to: 4 Beta 2
     6Stable tag: 1.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939* Checks for existence of title attribute before adding anything. Filters title with esc_attr() to avoid any markup in the title breaking the img tag.
    4040
     41= 1.5 =
     42* Now adds titles to gallery thumbnails, which also works for at least some lightbox plugins. Thanks to photoMaldives for posting code and OC2PS for prompting me to update the plugin.
     43
    4144== Upgrade Notice ==
    4245
     
    4750Checks for existence of title attribute before adding anything. Filters title with esc_attr() to avoid any markup in the title breaking the ing tag.
    4851
     52= 1.5 =
     53New feature - now adds titles to gallery thumbnails and to images displayed by lightbox plugins.
  • restore-image-title/trunk/restore-image-title.php

    r645012 r964749  
    33Plugin Name: Restore Image Title
    44Description: Reverses WP 3.5's behaviour of stripping title from images inserted into posts
    5 Version: 1.1
     5Version: 1.5
    66License: GPL
    77Author: Les Bessant
     
    2121}
    2222add_filter( 'media_send_to_editor', 'lcb_restore_image_title', 15, 2 );
     23
     24function lcb_restore_title_to_gallery( $content, $id ) {
     25    $thumb_title = get_the_title($id);
     26    return str_replace('<a', '<a title="' . esc_attr($thumb_title) . '" ', $content);
     27}   
     28add_filter('wp_get_attachment_link', 'lcb_restore_title_to_gallery', 10, 4);
     29
    2330?>
Note: See TracChangeset for help on using the changeset viewer.