Home › Forums › Calendar Products › Events Calendar PRO › Adding link to featured image in single entry
- This topic has 7 replies, 2 voices, and was last updated 12 years, 1 month ago by
Barry.
-
AuthorPosts
-
March 3, 2014 at 10:37 am #111639
Joseph Coppola
ParticipantI found this post but it seems I am missing something.
I am trying to have the featured image link to the actual Event URL, I have used the following code
“> <?php echo tribe_event_featured_image(); ?>
But it seems that the tribe_event_featured_image() function also returns a hyperlink.. This a problem.
Please tell me how to replace the feature image link.
March 3, 2014 at 10:44 am #111644Joseph Coppola
ParticipantHere is the sample code… it didn’t through.
“> <?php echo tribe_event_featured_image(); ?>March 3, 2014 at 10:45 am #111647Joseph Coppola
Participant[code] <a>"> <?php echo tribe_event_featured_image(); ?> </a>[/code]
March 3, 2014 at 10:47 am #111653Joseph Coppola
ParticipantIt keeps cutting off my code… not sure how to paste code in here.
March 3, 2014 at 4:43 pm #111908Barry
MemberYes, unfortunately the forum isn’t the best venue for sharing code at present – using a service like Pastebin or Gist and dropping the link in here is usually best.
You’re correct that our own tribe_event_featured_image() function returns a fully formed link. However, the featured images are like any others in WordPress – so you can substitute WordPress’s own functions like get_the_post_thumbnail() and any other suitably related template tags.
Does that help?
March 3, 2014 at 5:02 pm #111929Joseph Coppola
ParticipantOk. So then the post I linked to was wrong? That post said it would return the featured image… not a formed link.
Since Im not a WP developer any chance you can tell me what the right code would be to display the featured image with a link to the Event URL?
March 4, 2014 at 11:48 am #112397Barry
MemberI think possibly you’re misunderstanding – it’s suggesting to strip out that function, precisely because it does return an image already wrapped up within a link. The basic pattern to wrap up the thumbnail in a link that points to the single event page would be:
<a href="<?php echo tribe_get_event_link() ?>"><?php echo get_the_post_thumbnail() ?></a>If you are not doing this from within the single event page (where of course that link would be redundant) you may need to pass in the event ID to both of those functions:
<a href="<?php echo tribe_get_event_link( $id ) ?>"><?php echo get_the_post_thumbnail( $id ) ?></a>I hope that helps 🙂
March 19, 2014 at 8:05 am #121036Barry
MemberIt doesn’t look like you’ve got any further questions on this one and so I’ll go ahead and close the thread: of course if we can help with anything else please don’t hesitate to create new threads as needed. Thanks!
-
AuthorPosts
- The topic ‘Adding link to featured image in single entry’ is closed to new replies.
