Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* HTML STRUCTURE - WP CAPTIONS - FOR REFERENCE ONLY
- <dl class="gallery-item">
- <dt class="gallery-icon">
- <a href="IMAGE LINK" title="" class="fancybox" rel="gallery">
- <img src="THUMBNAIL-LINK" class="attachment-thumbnail" alt="" title="">
- </a>
- </dt>
- <dd class="wp-caption-text gallery-caption">
- CAPTION HERE
- </dd>
- </dl>
- */
- /* JQUERY CODE */
- jQuery( 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".gif"], a[href$=".png"]' ).each( function () {
- var imageTitle = '';
- if ( jQuery( this ).next().hasClass( 'wp-caption-text' ) ) {
- imageTitle = jQuery( this ).next().text();
- }
- jQuery( this ).attr( 'title', imageTitle );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement