Support » Plugin: Event Organiser » [Plugin: Event Organiser] Color Code for Venues instead of Categories?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can associate a colour to a venue using by creating adding a custom metabox to the venue page and storing the colour as venue meta (see this page on saving/retrieving venue meta data).

    However, there is not (yet) anyway to filter the ajax response for the calendar, or indeed the event colour to replace it with some other value. This will be added in 1.6 (due end of this month).

    So it will be possible.

    I’ll try to remember to post here details of how to filter the event colour – if I forget, feel free to bump this thread.

    Yeah, that would be really helpful. I think that’s the only thing holding me back from this being the perfect plugin for our use.




    Stephen…were you able to add this feature?

    Stephen Harris


    The filter has been added, buts its till in beta. It’s almost ready to go but I want to do some checks (and have others do the same) before releasing). You can find the latest beta release on GitHub (dev branch):

    It’s pretty stable – but I wouldn’t recommend using it on a live site just yet.

    You’ll still need to add a custom metabox to the venue page and store the colour as venue meta. Then using that filter (eventorganiser_event_color) you can change the event colour:

    function my_change_event_color( $color, $event_id ){
       $venue_id = eo_get_venue($event_id);
       $new_colour = '#ff0000';//Get colour of event, from the venue
       return $new_colour;

    Note caching might mean your changes aren’t immediate – you can update an event to clear the cache.

    I’ll post some code on how to store/update a venue’s colour shortly.



    Thanks a ton. Here’s what I’ve got so far. Apologies, I’m a bit inexperienced with plugin development.

    //Metabox for saving color of venue
     function my_add_metabox(){
          add_meta_box('my_id','Venue Color', 'my_metabox_callback', 'event_page_venues', 'side', 'high');
     function my_metabox_callback(){
        //Metabox's innards:
        $venuecolor = eo_get_venue_meta($venue->term_id, '_venue_color',true);
        //Remember to use nonces!
        wp_nonce_field( 'my_venue_meta_save', 'my_plugin_nonce_field' );
        <input type="text" name="my_venue_color" value="<?php echo esc_attr($venuecolor);?>" >
     add_action ('eventorganiser_save_venue','my_save_venue_meta');
    function my_save_venue_meta( $venue_id ){
        //Check permissions
        $tax = get_taxonomy( 'event-venue');
        if ( !current_user_can( $tax->cap->edit_terms ) )
        //Check nonce
        check_admin_referer('my_venue_meta_save', 'my_plugin_nonce_field');
        //Retrieve meta value(s)
        $value = $_POST['my_venue_color'];
        //Update venue meta
        eo_update_venue_meta($venue_id,  '_venue_color', $value);

    This has created the metabox ok, but it doesn’t seem to be storing the value yet.

    Once that’s working, I’ll add the filter below that code, and whatever I save in that metabox will then become the venue color for the calendar?

    Thanks again!

    Stephen Harris


    I think it probably is – but the example on the page I linked to is a bit buggy. Try adding $venue as an argument to the my_metabox_callback() function:

    function my_metabox_callback( $venue ){

    Then in my previous post:

    $new_colour = eo_get_venue_meta($venue_id, '_venue_color',true);

    This should now be do-able – 1.6. was released earlier today. See for more information.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Event Organiser] Color Code for Venues instead of Categories?’ is closed to new replies.