Home › Forums › Calendar Products › Events Calendar PRO › Adding custom fields to event price
- This topic has 5 replies, 2 voices, and was last updated 9 years ago by
Giovanni.
-
AuthorPosts
-
March 17, 2017 at 4:23 am #1255726
Giovanni
ParticipantHi guys,
i have a little question about customizing fields.
Every of my events have more than one single price, but in the price field of my events where i can put currency and cost, i have just one label where i can put it.
Is there a way so that i can add more labels in the price field or maybe create a new field where i can put another price?Hope i can have assistence
ThanksMarch 17, 2017 at 3:53 pm #1256118Victor
MemberCiao Giovanni!
Thanks for reaching out to us! 🙂 Let me try and help you out.
You can enter several costs in the “cost field” (for example 100 500 300) like this > https://cloudup.com/cb-gmIFTFqJ This way, the function which is used to print the cost will show the min – max costs like this > $100 – $500
If that doesn’t work for you and you need to show exactly what you save in the cost field, then you will need to make a template override. You can learn how to do that in this great article > https://theeventscalendar.com/knowledgebase/themers-guide/
You will have to override the following template file /wp-content/plugins/the-events-calendar/src/views/single-event.php and in line 39 you could try replacing this:
echo tribe_get_cost( null, true )for this:
echo tribe_get_event_meta( $event_id, '_EventCost', true )I hope that helps. Let me know if you have other questions.
Best!
Victor
March 21, 2017 at 4:36 am #1257188Giovanni
ParticipantHi Victor,
Thanks for your suggestions but unfortunately it doesn’t,t change anything!
I edited that line in the single-event.php file inside the tribe-event folder in my theme folder, and I added this code
if( tribe_is_event() && is_single() ) { // Single Events
echo ‘were on a single event page’;
}Inside the default-templates.php file inside the same folder as the single-event.php, like it was suggested in the guide.
But I don’t see any changes nor in my fronted neither in my admin page.
I need too achieve this result, can I do that?
in the backend
And in the fronted:
March 21, 2017 at 5:35 am #1257206Victor
MemberHi Giovanni!
I tried your code myself and it works fine for me. Where are you pasting the single-event.php file? Make sure it is in a path like this > /wp-content/themes/[your-theme]/tribe-events/single-event.php
You don’t need to override the default-templates.php file for the above to work. But in case you also need to modify that template it you should also be in the same path like this > /wp-content/themes/[your-theme]/tribe-events/default-template.php
The changes you try to make are only to modify the frontend. There is no default way to override the admin templates.
Please let me know if that works for you and if you have other questions.
Best!
Victor
April 12, 2017 at 9:35 am #1268887Support Droid
KeymasterHey 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 ‘Adding custom fields to event price’ is closed to new replies.
