Displaying Custom Field Attributes on Frontend in Custom Template File

Home Forums Calendar Products Events Calendar PRO Displaying Custom Field Attributes on Frontend in Custom Template File

Viewing 15 posts - 16 through 30 (of 58 total)
  • Author
    Posts
  • #13705
    Janet
    Participant

    Thanks for the reply Rob .. my question is in the usage.

    I have a custom field “website”.

    The built in function tribe_the_custom_fields(‘website’) returns the custom label and value properly. But I simply want to pull the value of field.

    Am I correct in assuming get_tribe_custom(‘website’) should return only the value? I get a function does not exist error.

    #13728
    Rob
    Member

    Hi Janet. You are correct in assuming that, but I know that just this morning we discovered an issue with get_tribe_custom that was giving us problems. I’m not positive of the specifics but I’ve asked our dev Jonah to take a look in case he has a suggestion to tide you over until we get the get_tribe_custom issue resolved in 2.1.

    #13807
    Jonah
    Participant

    Hi Janet,

    There is no function named get_tribe_custom(), it was decided to stick with naming convention and go with tribe_the_custom_fields() instead. If you just want to pull in the value of a field just use:


    $custom_field = tribe_the_custom_fields('FieldLabel');

    And then you can do what you want with $custom_field which will contain the value of your field. Does that help?

    #14209
    Janet
    Participant

    Thanks Rob and Jonah!

    #14226
    Rob
    Member

    Happy to help, Janet. Do let us know if anything else comes up in the future and we’ll do what we can to assist.

    #14238
    Haavard
    Participant

    Hello! I’ve been listening to this thread over the past days now and trying out the custom fields option, however I think I’ve discovered a slightly error using the checkbox custom field…

    The situation is this;

    I’ve tied the events calendar up with a signup form, allowing my clients to accept signups to all events. Now in this case some events isn’t meant to get signups, so I went in added a custom checkbox field to be able to check that IF the event shouldn’t display a signup link.

    So it’s like an on/off switch, using “tribe_get_custom_fields” to see whether this checkbox is checked or not.

    Now once the custom checkbox field is checked and saved, it wont uncheck if you try to. Once you save it unchecked it will just go back to being checked, so it seems it’s not updating properly.

    Any ideas Rob, Jonah, anyone?

    #14256
    Rob
    Member

    Hey Haavard. Thanks for the note. Not sure about that; we’ll try and point you in the right direction on this, but no guarantees since it sounds like what you’ve done here is fairly customized to begin with. While I’m not sure what may be causing this, let me see if Jonah can help you out.

    #14290
    Jonah
    Participant

    Hey Haavard, you’re right this appears to be a bug. I’ll create a ticket for it and we’ll get it fixed ASAP. In the interim you may want to try using Advanced Custom Fields (http://www.advancedcustomfields.com/) for your purposes.

    Good luck!

    #14578
    Haavard
    Participant

    Thanks for the feedback Rob and Jonah! The Advanced Custom Fields work wonders, and was a great solution to this situation. Thanks for sending me in that direction. It turned out great!

    #14584
    Rob
    Member

    Awesome! Happy to help Haavard. If you need anything else please do let us know.

    #14753
    Ken
    Participant

    I am adding this to my template file for the listing:

    But this is what is returned:

    Duration:

    Duration:90 minutes

    Is there a way to return the just the value of the custom field instead of both the field label and the value? The method works fine for the single event page but the list template uses a table not a tag. Would the other choice be to re-write the list.php template file using instead of a ?

    #14754
    Ken
    Participant

    The post did not like the code.

    Here is a link to the code http://pastebin.com/cicLgGtV

    #14755
    Jonah
    Participant

    Hey Ken, we’ve got 3 functions available for event custom fields:

    – tribe_custom_field(‘Label Name’) – Echo Event Custom Field by Label
    – tribe_get_custom_field(‘Label Name’) – Get Event Custom Field by Label
    – tribe_get_custom_fields() – loops through all custom fields and builds an array of them
    – tribe_the_custom_fields() – loops through all custom fields and builds a definition list

    You’ll probably want to use tribe_custom_field(‘Label Name’).

    I hope that helps,
    Jonah

    #14794
    Ken
    Participant

    Thanks Jonah, I could not find those functions. That solved my issue.

    #14800
    Jonah
    Participant

    Glad that worked Ken, I’ll make sure to update the documentation so it’s there.

Viewing 15 posts - 16 through 30 (of 58 total)
  • The topic ‘Displaying Custom Field Attributes on Frontend in Custom Template File’ is closed to new replies.