Advertisement
Guest User

Untitled

a guest
Apr 26th, 2012
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     </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.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement