Viewing 7 replies - 1 through 7 (of 7 total)
  • Stephen Harris

    (@stephenh1988)

    Yes – see this thread for an example

    Stephen Harris

    (@stephenh1988)

    Ah wait – wrong calendar :). So the answer is yes – but only in 1.6 (currently in Beta). See this thread instead ??

    tunixtunix

    (@tunixtunix)

    I’d be VERRRY interested in that feature, too ??

    Will it be possible to jump directly to an event from a specific category, even though there are other events on that date in a different category?

    You know, I’m the one how uses your plugin for short stories. I have 5 of them each day. I also want to include a “daily tip”, so I’d make another category “tipps” with only one event every day (with yearly repeat) and jump from the submenu directly to the tip, instead of a list with only one entry.

    Would that be possible? When will you release 1.6?

    thank you so much!

    Stephen Harris

    (@stephenh1988)

    Certain will. Let’s suppose we want to link to a category page – and, if present, we want ‘tipps’ to be used. (We’ll also link to the category page, but filter by events starting that are ‘running’ that day using the ondate parameter)

    add_filter('eventorganiser_widget_calendar_date_link', 'tunixtunix_link_to_event_cat',10,3);
    function amen_link_straight_to_event( $link, $date, $events ){
           //Note $date is a datetime object corresponding to a day in the widget calendar
    
           //Sanity check
           if( !$events )
               return $link;
    
           //Let's get all the event terms:
           $event_cats = array();
           foreach( $events as $event ){
              $terms = get_the_terms( $event->ID, 'event-category' );
              if( $terms)
                 $events_cats += $terms;
           }
    
           //If not event categories, abort
           if( !$event_cats )
              return $link;
    
           //Extract the term slugs
           $event_slugs = wp_list_pluck( $event_cats, 'term' );
    
           if( in_array('tipps', $event_slug ) ){
               $slug = 'tipps';
           }else{
               //Tipps not present, just pick another category
               $slug = array_pop( $event_slugs )
           }
    
            //Get link to that category, and append 'ondate'
           $link = add_query_arg('ondate',$date->format('Y-m-d', get_term_link( $slug, 'event-category' );
    
            return $link;
    }

    **Note:** This is not tested, but should work in principle. It will only work for **1.6** or above which is currently in beta. I’m not plaining on releasing this until after WP 3.5 (which is due to be out 5th December). You can expect it shortly after – but I’d like to do some more bug tests ??

    Stephen Harris

    (@stephenh1988)

    The code above is a bit buggy – I’ve not tested it, but I can see some syntax errors. I’ve made this gist: https://gist.github.com/4133300

    1.6 was released earlier today so the above filter is available. You can find out more here: https://wp-event-organiser.com/blog/1-6-released/

    Thank you Stephen – I’ll give it a try

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Go directly to event’ is closed to new replies.