Is it possible to add additional fields to Venues?

Home Forums Calendar Products Events Calendar PRO Is it possible to add additional fields to Venues?

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #17979
    Martijn Meyer
    Participant

    We need two extra fields for Venues: mail and website. Is it possible to add them? You can add additional fields, but they are added to Events.

    #17988
    Rob
    Member

    Hi Martijn. Thanks for reaching out here; this is an interesting request. I don’t know what it’d take to accomplish (or if it’s even possible) but I’ve asked our dev Jonah to take a look and see if he can point you in the right direction.

    Jonah is out until tomorrow, but should be back and taking a look at that point. Stay tuned!

    #17993
    Henry
    Member

    You can make the venue post type support WordPress custom fields by modifying the-events-calendar-class.php file.

    Look for this code protected $postVenueTypeArgs = array( (it is around line 32)

    You need to add support for custom fields. See my code here that works nicely for me.
    http://pastie.org/3805194

    Be aware if you upgrade The Events Calendar you will loose these changes. Jonah might know of a way to do this without hacking the core.

    #18022
    Jonah
    Participant

    Hey Martijn,

    Luckily you can get Venue’s to support custom fields without hacking the core. Just use the native add_post_type_support() function: http://codex.wordpress.org/Function_Reference/add_post_type_support


    add_post_type_support( 'tribe_venue', array('title', 'editor', 'custom-fields') );

    Honestly I wouldn’t use WordPress’ custom fields though. I would suggest looking at the much more powerful and easier to use: http://www.advancedcustomfields.com/

    I hope that helps!

    #18027
    Martijn Meyer
    Participant

    Thanks for the answers. FYI I want to add them in the Venue Information block. Reason for this is I am building a site for a customer. This site will have events (with their own ticket url), venues (with their own url) and organisers (with also their own url).

    Customer will use organisers which organize events at multiple venues. Or use events (restaurant deal for example) at venues (a restaurant) which doesn’t have a clear organiser.

    To keep input as easy as possible url and e-mail should be added to the Venue Information block, since other people will add information. Fields on different places is not user friendly.

    #18029
    Henry
    Member

    @Martijn,

    I am pretty sure that would mean hacking the plugin core. If you’re going to hand over to a client then i’d suggest leaving the core untouched as if your client decides to update the plugin at a future date, all of your changes will be lost.

    #18030
    Martijn Meyer
    Participant

    @Henry,

    Therefore I ask it overhere. Maybe it is a nice addition for a future version. Since events, venues and organizers can all have their own website.

    #18031
    Henry
    Member

    @Martijn

    I agree, great suggestion. You could go one step more and instead of having fixed custom fields in the venue/event/organiser information block, you could have variable fields where the user can specify their own name/value pair (in the same way as WP custom fields work now)

    #18037
    Jonah
    Participant

    @Martijn, yeah unfortunately that’s not currently possible to have fields in the Venue Information block. You can request that as a feature here though: https://theeventscalendar.com/support/forums/topic/events-calendar-pro-feature-requests/

    #18576
    Amy Kiser
    Participant

    @Jonah
    Where would I add the add_post_type_support code? Would it go in a functions.php file for the theme? Thanks for entertaining my naive question.
    – David

    #18580
    Henry
    Member

    @David

    Jonah’s code goes in your theme’s functions.php file. As pointed out in the WP function reference, typically add_post_type_support() should be attached to the ‘init’ action hook.

    Example:
    http://pastebin.com/jMhkWhmz

    #18581
    Amy Kiser
    Participant

    Many thanks, @Henry!

    #18586
    Jonah
    Participant

    Thanks Henry and David, please let us know if there’s anything else you need with this.

    #976709
    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 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Is it possible to add additional fields to Venues?’ is closed to new replies.