SHOW:
|
|
- or go back to the newest paste.
1 | /* HTML STRUCTURE - WP CAPTIONS - FOR REFERENCE ONLY | |
2 | <dl class="gallery-item"> | |
3 | <dt class="gallery-icon"> | |
4 | <a href="IMAGE LINK" title="" class="fancybox" rel="gallery"> | |
5 | <img src="THUMBNAIL-LINK" class="attachment-thumbnail" alt="" title=""> | |
6 | </a> | |
7 | - | jQuery( this ).attr( 'rel', 'lightbox' ).attr( 'title', imageTitle ); |
7 | + | </dt> |
8 | <dd class="wp-caption-text gallery-caption"> | |
9 | CAPTION HERE | |
10 | </dd> | |
11 | </dl> | |
12 | */ | |
13 | /* JQUERY CODE */ | |
14 | jQuery( 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".gif"], a[href$=".png"]' ).each( function () { | |
15 | var imageTitle = ''; | |
16 | if ( jQuery( this ).next().hasClass( 'wp-caption-text' ) ) { | |
17 | imageTitle = jQuery( this ).next().text(); | |
18 | } | |
19 | ||
20 | jQuery( this ).attr( 'title', imageTitle ); | |
21 | }); |