Home › Forums › Calendar Products › Community Events › * Required image
- This topic has 8 replies, 2 voices, and was last updated 6 years, 5 months ago by Rob Bennett.
-
AuthorPosts
-
October 7, 2017 at 9:00 am #1360728Rob BennettParticipant
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
RobOctober 9, 2017 at 5:04 am #1361054Rob BennettParticipantThis reply is private.
October 9, 2017 at 7:02 pm #1361352VictorKeymasterHi 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,
VictorOctober 20, 2017 at 4:55 am #1366393Rob BennettParticipantThis reply is private.
October 20, 2017 at 7:04 am #1366476VictorKeymasterHi 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,
VictorOctober 23, 2017 at 10:34 am #1367614Rob BennettParticipantThis reply is private.
October 23, 2017 at 9:32 pm #1367864VictorKeymasterHi 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,
VictorNovember 14, 2017 at 8:35 am #1382624Support DroidKeymasterHey 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 -
AuthorPosts
- The topic ‘* Required image’ is closed to new replies.