Conditionally Display Custom Field

Home Forums Calendar Products Events Calendar PRO Conditionally Display Custom Field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27284
    Reggie
    Participant

    Question, what’s the best way to dynamically display one of the Tribe custom fields? For example, I have an RSVP link field and if the custom field has a link in it, I want to make it into a button. If the contents is empty, I don’t want to display anything.

    Here was my first attempt:


    <?php $RSVP = tribe_get_custom_field($post->ID, 'RSVP', true);
    if ($RSVP) { ?>
    <a class="rpr-button" href="<?php echo tribe_get_custom_field('RSVP'); ?>">Click here to reserve your spot!</a>
    <?php }
    else { ?>
    <?php } ?>

    #27308
    Barry
    Member

    Hi Reggie – something like this works for me http://pastebin.com/yVzuWhP1 … what I’d highlight is that tribe_get_custom_field() only accepts two parameters (not three) and the post ID is optional.

    Does that help here?

    #27641
    Barry
    Member

    Hi Reggie – do you need any further support here or are you all sorted?

    #978117
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Conditionally Display Custom Field’ is closed to new replies.