Home › Forums › Calendar Products › Events Calendar PRO › add 'duration' to 'details'
- This topic has 7 replies, 2 voices, and was last updated 10 years ago by
Geoff.
-
AuthorPosts
-
April 19, 2016 at 3:31 am #1104135
teubl
ParticipantHi there,
I see how i can create an extra field to add to the event-details section. However, I’d like to add ‘duration’ to ‘details’ (first column).
How can i add this?Thanks!
April 19, 2016 at 8:21 am #1104251Geoff
MemberHey again!
We call that area with the details the “meta” of the single event template. You can customize that the same way you did with other templates (making a copy and dropping it into your theme) but using this template instead:
/wp-content/plugins/the-events-calendar/src/views/meta/details.php
From that, you would need to add your custom field for “Duration” to that file where you would like it to display.
Keep in mind that the field will still continue to display in the third column, so you may need to remove it from this template:
/wp-content/plugins/events-pro/src/views/meta/additional-fields.php
Another way to go about this would be to use the Advanced Custom Fields plugin, create an additional field for “Duration” in there and then drop the code for the additional field into the first template mentioned above. That would prevent you from needing to update the second template as well.
Cheers!
GeoffApril 20, 2016 at 5:25 am #1104773teubl
ParticipantHi,
I couldn’t find the .php in the pro-event-calendar folder, yet i’ve found the details.php in plugins/the-events-calendar/src/views/modules/meta.
But where can i find the code of the additional field ‘duration’ i made in WP to place in the details.php?
Cheers.
-
This reply was modified 10 years ago by
teubl.
April 20, 2016 at 7:35 am #1104840Geoff
MemberHi there!
Well, it’s good news that you were able to find the first file. You can include your custom field in that file using the tribe_get_custom_field() function like this:
<?php tribe_get_custom_field('your-custom-field-label'); ?>…where you would like to use the custom field.
I’m a little concerned that you were unable to locate the other file. Are you sure you followed this path:
/wp-content/plugins/events-pro/src/views/meta/additional-fields.php
Thanks!
GeoffApril 20, 2016 at 7:50 am #1104848teubl
ParticipantThanks,
i can find the additional fields php alright, but i don’t see what to do with it? I can remove the extra field through wordpress?
I’d like an extra variable field for the duration both in the backend (so admins can fill it in) as well on the frontend where it shows the duration to visitors.
Can i use the additional field i made in the events calendar (backend in wp) or do i need to use ACF? In ACF i made a custom field, but don’t see how to add into the details.php will work out, as it needs to be seen in the backend under the event meta options?
Cheers,Ed’
April 20, 2016 at 3:52 pm #1105121Geoff
MemberHey there, Ed!
You will likely need to write a filter to prevent the additional field for “duration” from appearing in the third column. I’m sorry to say I do not have a snippet for that.
ACF might be the way to go. Create that “duration” field, apply it to the Events post type, and then follow the ACF docs to add it to the details.php template. That will allow you to show the field on the front and back end of the site.
Cheers!
GeoffApril 21, 2016 at 1:08 am #1105256teubl
ParticipantThanks, i redid some steps with ACF and it works now – not sure where it went wrong earlier.
One thing; Currently the newly created ‘duration’ field is placed way below the visual composer, how can i move the field up and style the field in the backend of WP?
preferably in ‘the events calendar’ section below time and date. Should i add it in an admin…php?
Cheers!
April 21, 2016 at 7:25 am #1105339Geoff
MemberAwesome, glad that did the trick!
Moving the ACF field is something I think you can do in the ACF settings for that particular field group. You may need to consult the ACF docs or perhaps support for how the fields interact with visual composer.
I’m going to go ahead and close this thread since the field is now active and you were able to get it into the event template — nice work! Feel free to let us know if any other calendar-related questions pop up and we’d be happy to help as best we can. 🙂
Cheers,
Geoff -
This reply was modified 10 years ago by
-
AuthorPosts
- The topic ‘add 'duration' to 'details'’ is closed to new replies.
