Show owner underneath image

Home Forums Calendar Products Events Calendar PRO Show owner underneath image

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1189784
    Oliver
    Participant

    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 view

    Hopefully most of them are generated by one or two files πŸ˜‰

    Best regards,
    Oliver

    #1189798
    Nico
    Member

    Hi 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,
    Nico

    #1190019
    Oliver
    Participant

    Hi 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.
    #1190202
    Nico
    Member

    Thanks 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,
    Nico

    #1190259
    Oliver
    Participant

    Hi 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,
    Oliver

    #1190853
    Nico
    Member

    Stocked 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:


    ...

    ...

    Please let me know if this works for you,
    Best,
    Nico

    #1193108
    Oliver
    Participant

    Perfect! 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,
    Oliver

    #1193857
    Nico
    Member

    Stocked 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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Show owner underneath image’ is closed to new replies.