Home › Forums › Calendar Products › Events Calendar PRO › Show owner underneath image
- This topic has 8 replies, 3 voices, and was last updated 7 years, 5 months ago by Oliver.
-
AuthorPosts
-
November 9, 2016 at 9:55 am #1189784OliverParticipant
Hi Geoff,
in Germany we have a very strict copyright law.
It says that when publishing an image (which you are not the owner) on an website, the owner has to be named underneath the image.Therefore I want to modify the views which are responsible for showing the image.
Can you name me the responsible php-files for generating the following views?– List view (http://www.treffpunkt-jazz.de/events/list/)
– Photo view (http://www.treffpunkt-jazz.de/events/foto/)
– Day view (http://www.treffpunkt-jazz.de/events/heute/)
– Map view (http://www.treffpunkt-jazz.de/events/karte/)
– Detail view of event (e.g. http://www.treffpunkt-jazz.de/event/23-jazzmeile-thueringen/)
– Box with “related events” (at the end of the detail viewHopefully most of them are generated by one or two files π
Best regards,
OliverNovember 9, 2016 at 10:23 am #1189798NicoMemberHi there Oliver,
Thanks for getting in touch with us! I can help you on this π
I think an easier way might be to alter the output of the function that displays the event featured image. This way it will be changed in all the site with just one hook.
Do you know how you will be generating this notice? Is the author of the image saved as meta data of the ‘attachment’ or the event?
Please let me know about it and I’ll try to build this customization for you,
Best,
NicoNovember 9, 2016 at 3:43 pm #1190019OliverParticipantHi Nico,
that’s an excellent idea! That would be the easiest way! π
The owner of the image is stored in a custom field of the Event Calendar (_ecp_custom_1).
I want to read it out via tribe_get_custom_field() and afterwards print it under the image.Do you have a snippet available or can tell me the name of the function / php-file to manipulate the rendering of the event image? (maybe via a filter?)
Best regards,
Oliver- This reply was modified 7 years, 5 months ago by Oliver.
November 10, 2016 at 3:39 am #1190202NicoMemberThanks for following up Oliver!
Use the snippet below by pasting it into your theme’s (or child theme’s) functions.php file:
/* Tribe, add copyright to image */
function tribe_add_image_copyright ( $featured_image, $post_id, $size ) {// bail if no image is displayed
if ( $featured_image == '' ) return $featured_image;// get image author
$custom = tribe_get_custom_fields();// bail if no author set
if ( !isset( $custom['custom_1'] ) ) return $featured_image;// build the copyright
$copy = '<span class="copyright">Image copyright sample: '. $custom['custom_1']. '</span>';return $featured_image . $copy;
}
add_filter( 'tribe_event_featured_image', 'tribe_add_image_copyright', 10, 3 );
After adding this make sure the right custom field key is in place, and review the site to check if there’s any place where this is not displayed.
Best,
NicoNovember 10, 2016 at 6:07 am #1190259OliverParticipantHi Nico,
that works brilliant! Thanks for the answer! π
Only for the “related events” (“Γhnliche Veranstaltungen”) box it doesn’t show the owner. For an example have a look here:
http://www.treffpunkt-jazz.de/event/23-jazzmeile-thueringen/Maybe because its the thumbnail and not the featured image (tribe-related-events-thumbnail vs tribe-events-event-image)?
Best regards,
OliverNovember 11, 2016 at 5:46 am #1190853NicoMemberStocked to hear the snippet work almost for every place in the site π
Regarding related events, you are right for some reason it’s not using the tribe_event_featured_image function but default get_the_post_thumbnail WordPress function. I think the best option here is to do a template override of the file wp-content/plugins/events-calendar-pro/src/views/pro/related-events.php and insert the conditional in there:
..." class="url" rel="bookmark">ID ) ) {
$custom = tribe_get_custom_fields( $post->ID );
if ( isset( $custom['custom_1'] ) ) {
echo 'Image copyright sample: '. $custom['custom_1']. '';
}else{
echo 'nop';
}
} ?>...
Please let me know if this works for you,
Best,
NicoNovember 16, 2016 at 6:50 am #1193108OliverParticipantPerfect! Now the owner is shown under all images π
Thanks a lot for your support!
Just an idea: would it make sense to change this part in the code of the Events Calendar, that “everywhere” the featured image function is used?
Best regards,
OliverNovember 17, 2016 at 8:27 am #1193857NicoMemberStocked to hear Oliver! Thanks for the suggestion, I’ll create a ticket for this π
Iβll go ahead and close out this thread, but if you need help with anything else please donβt hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Show owner underneath image’ is closed to new replies.