Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter vyabsley

    (@vyabsley)

    Sorry to bump such an old thread, but I can’t seem to get this working any more!

    It would be very useful to be able to add a single event to a Google (or iCal) calendar.

    Ideally what I’m trying to do is make it so that in the event-meta, the date is clickable to add the single event to the calendar. This way, for single events, just clicking the date is fine – and for reoccuring events, since you have a list of dates to pick from you can click on the one that you want to add to your calendar.

    Thread Starter vyabsley

    (@vyabsley)

    Sorry for the double-post, but I was able to get the height thing working. I don’t really need the other attributes (e.g. width, venue array, etc) working yet, so I’ll leave it for now – but here’s the code (mostly replicating the proper in-built map shortcode) in case it’s of use to anyone else.

    <?php
    function eo_upcoming_events_map($args=array()) {
    $args_array = array('zoom' => 15, 'scrollwheel'=>true, 'zoomcontrol'=>true, 'rotatecontrol'=>true,
    			'pancontrol'=>true, 'overviewmapcontrol'=>true, 'streetviewcontrol'=>true,
    			'maptypecontrol'=>true, 'draggable'=>true,'maptypeid' => 'ROADMAP',
    			'width' => '100%','height' => '200px','class' => '',
    			'tooltip'=>false
    			);
    $args = shortcode_atts($args_array , $args );
    		//Cast zoom as integer
    		$args['zoom'] = (int) $args['zoom']; 
    
    		//Escape attributes
    		$width = esc_attr($args['width']);
    		$height = esc_attr($args['height']);
    		$class = esc_attr($args['class']);
    		 //If class is selected use that style, otherwise use specified height and width
    		if( !empty($class) ){
    			$class .= " eo-venue-map googlemap";
    			$style = "";
    		}else{
    			$class = "eo-venue-map googlemap";
    			$style = "style='height:".$height.";width:".$width.";' ";
    		}
    
    $events = eo_get_events(array(
    	   'events_start_after'=>'today',
    	   'showpastevents'=>false,//Will be deprecated, but set it to true to play it safe.
      ));
    
    $venue_array;
    
    if($events):
       foreach ($events as $event):
    		$venue_id = eo_get_venue($event->ID);
    		$venue_array[] = $venue_id;
       endforeach;
    endif;
    
    echo eo_get_venue_map($venue_array, array('height'=>$height));
    }
    
    add_shortcode('eo_upcoming_events_map','eo_upcoming_events_map');
    ?>

    So now I can use [eo_upcoming_events_map height=”600px”] on a page to display only venues with upcoming events.

    Thread Starter vyabsley

    (@vyabsley)

    Awesome, thank you!

    I’m still playing around with how to specify the map height, but I’ve learned so much more about WordPress by coding up this shortcode than I have from months of using it generally.

    Here’s what I came up with using your documentation:

    <?php
    function eo_upcoming_events_map() {
    $events = eo_get_events(array(
    	   'events_start_after'=>'today',
    	   'showpastevents'=>false,//Will be deprecated, but set it to true to play it safe.
      ));
    $venue_array;
    
    if($events):
       foreach ($events as $event):
    		$venue_id = eo_get_venue($event->ID);
    		$venue_array[] = $venue_id;
       endforeach;
    endif;
    
    echo eo_get_venue_map($venue_array);
    }
    
    add_shortcode('eo_upcoming_events_map','eo_upcoming_events_map');
    ?>

    Thread Starter vyabsley

    (@vyabsley)

    Just a little update on this. I had the “Types” plugin installed. It got updated today and suddenly Events Organiser is back in my list.

    Looking through the Types changelog I see this:
    Fixed compatibility with ACF, Events Calendar and a number of other plugins due to removed actions

    Seems like the fault was with their plugin in the end.

    Thread Starter vyabsley

    (@vyabsley)

    No, still not showing in the updates. I assume when I tried updating the unrelated plugin then something happened on my end and it sort of half-tried to update EO. I’m sure it’ll all fix itself whenever there’s another regular EO update anyway. ??

    Thread Starter vyabsley

    (@vyabsley)

    I’ll wait for the next big update then, sorry about that! ??

    Thread Starter vyabsley

    (@vyabsley)

    I’ve put the code from the github page into includes/functions.php in my theme folder, I hope that’s the right place!

    The code I pasted above is still only showing the venue and not the date, but again I’m pretty dumb with WordPress so I’m sure I’m missing something somewhere!

    Thread Starter vyabsley

    (@vyabsley)

    I’ve only been able to test it on PC, iPhone and iPad (hopefully Android is alright since it’s 15% of my readers!) but adding “min-width:200px” into the styles for <ul id=”eo-event-meta”> and the test div seems to have done the trick for now to keep everything looking nice. If I make my browser window comically thin it messes up, but anyone who does that to their browser deserves what they get. ??

    Thread Starter vyabsley

    (@vyabsley)

    I’m a bit dumb with WordPress still, so you’ll need to tell me which file needs edited and I’ll gladly chuck it in and test it out! ??

    Thread Starter vyabsley

    (@vyabsley)

    Ah, as long as there’s a reason why I can’t do it that’s grand. If it’s working in 1.8 then I’ll definitely have to get around to finding a donate link to give you some cash!

    Thread Starter vyabsley

    (@vyabsley)

    I know this has been marked as resolved, but I was just wondering if anyone had any thoughts on my second issue, where having the metadata of an event beside the map means that on a mobile phone screen everything gets really squished. I’d like the map to drop below the metadata if there’s no room.

    Thread Starter vyabsley

    (@vyabsley)

    It’s the generic site search, so blog posts show up in there too.

    Thread Starter vyabsley

    (@vyabsley)

    From the looks of it, I had an extra </div> in single.php which isn’t attached to an opening <div>, I wonder how I got that there. Thanks again for the help!

    Thread Starter vyabsley

    (@vyabsley)

    Ah, okay then. I’ll have a look in the theme files – thanks!

    vyabsley

    (@vyabsley)

    Seconding the hope for a .ics file for an individual event – subscribing to this thread ??

Viewing 15 replies - 1 through 15 (of 24 total)