Home › Forums › Calendar Products › Events Calendar PRO › Additional Fields in Events List
- This topic has 8 replies, 2 voices, and was last updated 11 years, 3 months ago by
Brian.
-
AuthorPosts
-
February 6, 2015 at 12:41 am #940445
Helen
ParticipantHi,
I’ve read through the other posts on this and looked through the documentation, but I’m struggling to know what code I need to place in my new templates (copied into my theme folder) in order to choose which additional fields I can display on the events list.
I’ve tried using this:
<?php echo tribe_custom_field(); ?></p>
And it just gives me an error.
Can someone point me in the right direction? I have four additional fields and I’d like to choose two of them to display below the venue details on the list page.
Thanks
Helen
February 6, 2015 at 3:07 am #940461Helen
ParticipantI’m now using this code in the list/single-event.php file:
<?php echo tribe_get_custom_field( ‘_ecp_custom_3’ ); ?>
It’s not creating an error, but nothing is appearing either.
Am I along the right lines now?
February 6, 2015 at 5:58 am #940492Brian
MemberHi,
Sorry for the issues you are having you are getting closer.
Try:
tribe_get_custom_fields();
https://theeventscalendar.com/function/tribe_get_custom_fields/
Let me know if that works.
Thanks
February 7, 2015 at 1:13 am #940691Helen
ParticipantThanks Brian, it’s returning ‘Array’ – I’m going to see whether I can work out how to make it return the content of the field, but if you have any tips, that would be much appreciated.
Thanks again,
Helen
February 9, 2015 at 5:28 am #940868Brian
MemberIs the field one that would have an array of values?
Also, here is the template functions for Pro and line 130 has tribe_get_custom_fields function:
events-calendar-pro\public\template-tags\general.php
February 10, 2015 at 12:58 am #941226Helen
ParticipantNo, there’s just a number entered into the field that I want to display.
I’ve pasted in the section of code from the general.php file, but that causes nothing to display.
How do I know what the label of the field is? Is it the one I’ve given it?
Thanks
Helen
February 10, 2015 at 7:14 am #941295Brian
MemberHi Helen,
Sorry for the confusion we changed the method and it was not clear to me either.
tribe_get_custom_fields actually returns an array of all additional fields created in Pro.
So this method will work to display the value of the additional field.
$additional_fields = tribe_get_custom_fields(); echo $additional_fields['Community Field'];Change ‘Community Field’ to the label of your field and it should work.
Let me know if it does.
Thanks
February 11, 2015 at 8:05 am #941616Helen
ParticipantThank you Brian!!
All working now 🙂
February 11, 2015 at 8:35 am #941630Brian
MemberGreat, glad it helps, I am going to go ahead and close this ticket, but if you need help on this or something else please post a new ticket.
Thanks!
-
AuthorPosts
- The topic ‘Additional Fields in Events List’ is closed to new replies.
