Home › Forums › Calendar Products › Events Calendar PRO › Getting custom fields for The Events Calender Class, not just one post.
- This topic has 6 replies, 4 voices, and was last updated 8 years, 8 months ago by Support Droid.
-
AuthorPosts
-
April 11, 2012 at 9:52 am #17816Susanne Thiede BarnetParticipant
Hi there, thanks for the great plugin.
I’m working on a javascript filtering system for events based on the custom fields. All works well. However, before I hand it off to the client. I’ve got a checkbox for each possible custom field category (which the user can choose based on checkboxes), and the function hides results that don’t match the category. Pretty standard stuff.
However, before I hand it off to the client, I would like to change from hardcoding the checkboxes to building up the list of checkboxes dynamically from the list of custom fields. That way, the client can remove/add custom fields at will without getting us to change stuff around. For example, an event can have any number of event types (including things like Arts, Cinema, Entertainment, Family-Friendly, etc).
The event-meta.php file seems to do this, but I can’t seem to find a good way to pull up the Event Calendar class itself to get this code to point to something. Thanks!
April 11, 2012 at 4:22 pm #17834JonahParticipantHi Kindra, I think you are probably looking for something like this then: https://gist.github.com/2344826
Just take out the unset function unless you want to exclude certain fields from the array.
April 12, 2012 at 8:27 am #17851Susanne Thiede BarnetParticipantIt appears that the function tribe_get_custom_fields() just gets the custom fields for one post. What I need is to get all the possible custom fields that are set up, so that the user can use radio buttons and checkboxes to sort the results by the custom fields they possess. Theoretically, I could use php or javascript to loop through all the events and get a list of all unique custom fields, but there’s gotta be a way to just pull the information from the database somewhere. After poking around around in the database, there didn’t seem to be a way to extract this in any legitimate, semantic way. Maybe using the Tribe Events API?
April 12, 2012 at 9:03 am #17853JonahParticipantHey Kindra, if you take a look at the tribe_get_custom_fields() function in /wp-content/plugins/events-calendar-pro/template-tags.php you will see that it is just ultimately using get_post_meta() – I’m not sure how in WordPress you can get all custom fields but I’m sure you can figure it out if you dig around a bit more. Good luck!
April 16, 2012 at 1:57 pm #17952Susanne Thiede BarnetParticipantLooks like all I was looking for was:
$customFields = tribe_get_option(‘custom-fields’, false);Thanks for the help! You can mark this discussion as solved.
April 16, 2012 at 6:04 pm #17965RobMemberAwesome to hear we’re all set here, Kindra. Thanks for confirming as much. Let us know what else we can do down the road.
July 6, 2015 at 5:00 pm #976508Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Getting custom fields for The Events Calender Class, not just one post.’ is closed to new replies.