Custom field not working – help please!

Home Forums Calendar Products Events Calendar PRO Custom field not working – help please!

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1154816
    Cliff
    Participant

    Hi,
    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!

    #1155316
    Josh
    Participant

    Hey 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!

    #1155323
    Cliff
    Participant

    Thanks 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.

    #1155978
    Josh
    Participant

    Hey 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!

    #1155989
    Cliff
    Participant

    Thank you Josh! “global $post;” made it work!

    #1156266
    Josh
    Participant

    Hey 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!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Custom field not working – help please!’ is closed to new replies.