Home › Forums › Calendar Products › Events Calendar PRO › Displaying Custom Field Attributes on Frontend in Custom Template File
- This topic has 57 replies, 12 voices, and was last updated 11 years, 11 months ago by Jonah.
-
AuthorPosts
-
January 20, 2012 at 4:25 pm #13705JanetParticipant
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.
January 20, 2012 at 7:53 pm #13728RobMemberHi 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.
January 22, 2012 at 6:32 pm #13807JonahParticipantHi 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?
January 26, 2012 at 12:41 pm #14209JanetParticipantThanks Rob and Jonah!
January 26, 2012 at 4:59 pm #14226RobMemberHappy to help, Janet. Do let us know if anything else comes up in the future and we’ll do what we can to assist.
January 26, 2012 at 11:02 pm #14238HaavardParticipantHello! 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?
January 27, 2012 at 7:55 am #14256RobMemberHey 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.
January 27, 2012 at 2:12 pm #14290JonahParticipantHey 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!
February 2, 2012 at 4:07 am #14578HaavardParticipantThanks 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!
February 2, 2012 at 9:39 am #14584RobMemberAwesome! Happy to help Haavard. If you need anything else please do let us know.
February 6, 2012 at 4:26 pm #14753KenParticipantI 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 ?
February 6, 2012 at 4:29 pm #14754KenParticipantThe post did not like the code.
Here is a link to the code http://pastebin.com/cicLgGtV
February 6, 2012 at 4:59 pm #14755JonahParticipantHey 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 listYou’ll probably want to use tribe_custom_field(‘Label Name’).
I hope that helps,
JonahFebruary 7, 2012 at 7:51 am #14794KenParticipantThanks Jonah, I could not find those functions. That solved my issue.
February 7, 2012 at 12:15 pm #14800JonahParticipantGlad that worked Ken, I’ll make sure to update the documentation so it’s there.
-
AuthorPosts
- The topic ‘Displaying Custom Field Attributes on Frontend in Custom Template File’ is closed to new replies.