Adding a link to Featured Image

Home Forums Calendar Products Events Calendar PRO Adding a link to Featured Image

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #16319
    Catherine
    Member

    Is there a way to have the featured image link to an external url? I’ve tried to add it to the link URL in the featured image settings but it disappears on save. I know this is probably a general WP issue, but any help is appreciated.

    #16359
    Rob
    Member

    Hi there Catherine. I believe you are correct in that this is a WordPress behavior (as I’ve never been able to link a featured image on any site I’ve worked on), but let me get Jonah from our dev team to take a quick look and confirm whether I’m right here.

    #16393
    Jonah
    Participant

    Hi Catherine, this is a matter of templating where you need to wrap your featured image code in the link you want to use. I’m guessing it will be a custom field as well? So, wherever in the template (whether in /wp-content/plugins/the-events-calendar/views/table.php or /wp-content/plugins/the-events-calendar/views/single.php) you’ll need to find where the featured image code is and wrap the thumbnail code in your link code. For instance, here is the thumbnail code in single.php (single events views) with a custom field for a link wrapped around it:

    https://gist.github.com/1995059

    Does that help?

    #16409
    Catherine
    Member

    Thanks very much guys! I’ll give this a try.

    #16458
    Rob
    Member

    Excellent! If you need anything else after giving it a go, Catherine, just holler.

    #17090
    Catherine
    Member

    I’m back. I’ve got a link now working on the feature image (had to modify the code you gave me slightly) but now the problem is getting it to link to my custom field. I created a custom field (using the WP custom fields section) but my image just links back to the event. Is there another place I should be creating the custom field?

    Here is modified the code I used (without the quotes):

    <a href="”>

    #17091
    Catherine
    Member

    Sorry…here is a link to the code:

    https://gist.github.com/1995059#comments

    #17122
    Rob
    Member

    Hi Catherine. Thanks for this; not sure how to approach it myself, but let me see if Jonah can share any thoughts.

    #17174
    Jonah
    Participant

    Hi Catherine, so you are working with WP custom fields and not the Tribe custom fields? Try the code I just commented with here: https://gist.github.com/1995059#comments

    Make sure to replace ‘img_link’ with whatever the key of your custom field is.

    #17178
    Catherine
    Member

    Hi Jonah,

    I’m not sure how to work with the Tribe custom fields…I don’t see where to set them up. I’ve tried your fix and can’t get it to work. The url on the image just comes up as “/Array” (with the website domain in front) rather than the url I’ve put in as my field value.

    #17180
    Jonah
    Participant

    Hi Catherine, do you have custom fields setup using the standard WP custom fields or the Tribe custom fields? The Tribe custom fields can be configured in Settings > The Events Calendar (and if you’re on 2.0.5 click into the new Additional Fields tab on the top). Otherwise the additional fields will be at the bottom of the settings page.

    If you haven’t already configured any custom fields anywhere then the above code is not going to help you. You need to add the custom field, then add the custom field values on your event posts and then the code should spit out the custom link.

    #17192
    Catherine
    Member

    Success!! Created a Tribe custom field and it works. Thanks Jonah for all your help and patience!

    #17193
    Jonah
    Participant

    Awesome Catherine, glad you got it working!

    #976414
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Adding a link to Featured Image’ is closed to new replies.