Viewing 1 replies (of 1 total)
  • Thread Starter jumbo1

    (@jumbo1)

    What I did so far (and it works) is:

    1- I added a “doc” attribute to the <a> tag of my image, so I get something like this with the name of the document I want to link to (taken from the nextgen database):

    <a rel="lightbox[set_1]" title="Picture1" href=".../wp-content/gallery/gallery1/pic1.jpg">

    2- I played with the code of jquery.colorbox.js to display my new “doc” attribute instead of the Title attribute, so I turned this:
    settings.title = settings.title || element.title

    Into this:
    settings.title = '<a class="doc" href="/wp-content/uploads/docs/'+$(element).attr('doc')+'">Download File'</a>';}

    And that’s it! Under each picture, I get a link to the document associated with it.

    This is a dirty fix for me. If anyone has a better solution without removing the original title code, please tell me about it. I’m a total noob when it comes to javascript.

Viewing 1 replies (of 1 total)
  • The topic ‘Add custom link under image’ is closed to new replies.