Getting custom fields for The Events Calender Class, not just one post.

Home Forums Calendar Products Events Calendar PRO Getting custom fields for The Events Calender Class, not just one post.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17816

    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!

    #17834
    Jonah
    Participant

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

    #17851

    It 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?

    #17853
    Jonah
    Participant

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

    #17952

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

    #17965
    Rob
    Member

    Awesome to hear we’re all set here, Kindra. Thanks for confirming as much. Let us know what else we can do down the road.

    #976508
    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 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Getting custom fields for The Events Calender Class, not just one post.’ is closed to new replies.