Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3048
    Cody Swanson
    Participant

    Hi All,

    I use the WPFolio Two theme for my photography website. I used to use JQuery Lightbox without an issue. At some point the titles of my photographs stopped displaying in Lightbox. This is frustrating since the titles are important to me. I discovered Responsive Lightbox and I like the look of Fancybox, but it also will not display the titles of my photos, all of which are titled in the media library. Is there a way to include these titles when displaying a gallery? Prettyphoto includes the titles, but I don’t like the look of that lightbox.

    I have a limited knowledge of coding, so I am a bit lost and frustrated. Any help would be greatly appreciated. Thank you,

    Cody
    http://www.cody-swanson.com

    #3101
    Bartosz
    Keymaster

    Cody, it’s great to see that there are still people who work with analog medium format photography (I’m a former creative photography student). Congratulations on your work.

    But let’s get to the point – this should help you out: http://wordpress.org/support/topic/add-the-title-of-an-image-to-the-image-link-in-gallery

    #3119
    Cody Swanson
    Participant

    Thanks for the kind words and for the link. That post seems to be what I’m looking for, but I am unsure where to copy paste that code info. Altering code frightens me since I really know next to nothing about it.

    Is there a simple way to add that function without breaking anything? Thanks much,

    Cody

    #3120
    Bartosz
    Keymaster

    Ok, so try pasting this into functions.php file of your theme:

    function add_title_attachment_link($link, $id = null) {
    	$id = intval( $id );
    	$_post = get_post( $id );
    	$post_title = esc_attr( $_post->post_title );
    	return str_replace('<a href', '<a title="'. $post_title .'" href', $link);
    }
    add_filter('wp_get_attachment_link', 'add_title_attachment_link', 10, 2);
    #3121
    Cody Swanson
    Participant

    It works! I pasted it in at the end of the functions.php and my titles are back. I also changed the title location in the settings of Fancybox and they appear nicely. Small, but readable.

    Thanks again, I really appreciate you taking the time to help me.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.