Home › Forums › Calendar Products › Events Calendar PRO › Get actual url to image rather than html fetched by tribe_event_featured_image?
- This topic has 3 replies, 3 voices, and was last updated 9 years, 8 months ago by Brian.
-
AuthorPosts
-
April 9, 2014 at 1:22 pm #130204adamfullerParticipant
Hi there,
I’m doing some modifications (via a child theme) to list-widget.php. I wish to display the image along with other details (title, date, etc.). tribe_event_featured_image() is useful but in this instance I’d like to fetch purely the link to the image.
Any ideas?
The reason I wish to do this is so that I can put my own bits and pieces (for css) in the a/img html. i.e. I want to add my own css classes and specify width & height.
I suppose the way to do it is to create my own function tribe_event_featured_image_url() … but where do I put that? Where is tribe_event_featured_image() defined?
I did have a search but couldn’t find anything useful on the forums.
April 9, 2014 at 1:29 pm #130209adamfullerParticipantIt’s always the way … as soon as you post you figure out a solution! I found the fucntion tribe_event_featured_image in “public/template-tags/general.php”, copied it to my own functions.php in my child theme and modified it accordingly so that $featured_image .= $image_src[0];
July 29, 2014 at 6:09 pm #534820loakineParticipantCan you please help me with this same thing. Since I cannot get the Theme to override the ‘general.php’ file ….what did you add to the ‘functions.php’ exactly? I copied over the function ‘tribe_event_featured_image’ but i get an error (Fatal error: Cannot redeclare tribe_event_featured_image(). I am trying to add rel=”‘. lightbox .'” to the <a href. I can get this to work just fine by editing the PLUGIN direclty @ public/template-tags/general.php but i would like to use the functions.php as you did. Thanks.
September 5, 2014 at 6:14 am #724426BrianKeymasterHi Loakine, sorry for missing your post.
I can answer your question.
You can move the function ‘tribe_event_featured_image’ into your theme’s function.php but you have to rename it to something like ‘loakine_tribe_event_featured_image’ as you cannot have two functions with the same name in PHP.
Then you can move for example the single-events.php to your theme according to our Themer’s Guide and change tribe_event_featured_image to ‘loakine_tribe_event_featured_image’ and it will then run that new function instead and you can make the modifications to that function in your functions.php.
That should get you to what you would like to do. I am going to close this topic as the original question was resolved. If you have any issues or would like some more help please create a new topic and reference this one.
Thanks
-
AuthorPosts
- The topic ‘Get actual url to image rather than html fetched by tribe_event_featured_image?’ is closed to new replies.