Home › Forums › Calendar Products › Events Calendar PRO › Custom field not working – help please!
- This topic has 6 replies, 3 voices, and was last updated 9 years, 8 months ago by
Josh.
-
AuthorPosts
-
August 23, 2016 at 8:58 am #1154816
Cliff
ParticipantHi,
I purchased the Events Calendar Pro and am trying to use a custom field on this event info page: http://new.jasnany.org/event/brooklyn-book-festival/I edited /wp-content/plugins/the-events-calendar/src/views/single-event.php with this code:
<div class=”event-status”>
<?php
echo get_post_meta($post->ID, ‘registration-status’, true)
?>
</div>and added a custom field to the event admin page called “registration-status”. I can see the div code in the live page source, but it’s empty, and the text in the custom field is not carrying over.
What am I doing wrong?
Thank you for your help!
August 24, 2016 at 7:34 am #1155316Josh
ParticipantHey Cliff,
Thanks for reaching out to us!
We are limited in the amount of support that we’re able to provide here for a customization such as this. As a starting point, would the event status field that you’re using be something that you could take advantage of the “Additional Fields” feature of our Pro plugin? There you can create the field within the Events > Settings and then select on each individual event.
To start debugging this though, a couple of places to look:
- Depending on where you’ve placed the code, you can “var_dump( $post)” to make sure the object is there and supplying the right ID for the function
- Make sure that the meta key (registration-status) is correct.
Let me know if this helps.
Thanks!
August 24, 2016 at 7:44 am #1155323Cliff
ParticipantThanks for your reply. I hope you can help, because I purchased the PRO version because I read that it supported custom fields.
I tried adding “var_dump( $post)” to a few different places in the template (not sure exactly where it should go) but wherever I put it, it just displays the word NULL on the page. And yes, the meta key is the correct one.
Any ideas?
Thanks.
August 25, 2016 at 11:40 am #1155978Josh
ParticipantHey Cliff,
Thanks for following up here!
Is the custom field added to the event details page added via our plugin and the Additional Fields tab within the Event Settings?
If not, try adding “global $post;” right before your output code above which should help here.
Let me know if this helps.
Thanks!
August 25, 2016 at 11:57 am #1155989Cliff
ParticipantThank you Josh! “global $post;” made it work!
August 26, 2016 at 5:05 am #1156266Josh
ParticipantHey Cliff,
Awesome! Glad that worked for you.
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.
Thanks!
-
AuthorPosts
- The topic ‘Custom field not working – help please!’ is closed to new replies.
