* Required image

Home Forums Calendar Products Community Events * Required image

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1360728
    Rob Bennett
    Participant

    Hi

    I would like images to be a required field for community events and also include some information about the box about the required format of the image e.g. <100KB 1000px x 561px.

    Any thoughts on how I could do this. I went into the PHP files but it wasn’t obvious.

    Thanks
    Rob

    #1361054
    Rob Bennett
    Participant

    This reply is private.

    #1361352
    Victor
    Keymaster

    Hi Rob!

    Thanks for getting in touch! Let me help you with this topic.

    We have an article that gives a few code examples you can use to make the community add event fields required here > https://theeventscalendar.com/knowledgebase/required-fields-for-events-submission-form/

    If you want to make the image required, you could try using the following code snippet:

    add_filter( 'tribe_events_community_required_fields', 'my_community_required_fields', 10, 1 );
    
    function my_community_required_fields( $fields ) {
    
    if ( ! is_array( $fields ) ) {
    return $fields;
    }
    
    $fields[] = 'event_image';
    
    return $fields;
    }

    If you also want to add custom text to the image box, you can achieve that using one of the methods described in our themer’s guide > https://theeventscalendar.com/knowledgebase/themers-guide/. You might want to have a look at the image.php template file located at /wp-content/plugins/the-events-calendar-community-events/src/views/community/modules/ 

    I hope it helps! Let me know if you have any follow up questions.

    Best,
    Victor

    #1366393
    Rob Bennett
    Participant

    This reply is private.

    #1366476
    Victor
    Keymaster

    Hi Rob!

    I’m sorry it didn’t work for you.

    Can you make sure you are placing the code into you active theme’s functions.php file? I tried it myself and it worked for me.

    Let me know.

    Thanks,
    Victor

    #1367614
    Rob Bennett
    Participant

    This reply is private.

    #1367864
    Victor
    Keymaster

    Hi Rob!

    Glad to know it’s working now.

    Regarding the ‘(required)’ text, this is something you will have to add via a template customization of the image.php template file located at /wp-content/plugins/the-events-calendar-community-events/src/views/community/modules/

    The “Event Image” title being underlined is also something that will require custom coding as it does not make use of the same validation system as the event title and description.

    To learn more about how to customize our templates please refer to our themer’s guide > https://theeventscalendar.com/knowledgebase/themers-guide/

    Let me know if you have any follow up questions and I’d be happy to help.

    Best,
    Victor

    #1382624
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

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