Support

Home Forums Events Calendar Add-on Calendar Shortcode is not working

Calendar Shortcode is not working

Posted: October 10, 2017 at 11:33 pm


rahmanmemon

October 10, 2017 at 11:33 pm

Hey!
I am using calendar shortcode in custom template but it only works with iframe not with shortcode . Also console is clear there is no such errors or conflict but still its not working with the shortcode.


Josh

  • Support Staff

October 11, 2017 at 10:09 am

Hey there,

The Calendar shortcode will not load the necessary assets include the JavaScript files and stylesheets(CSS) to render the calendar if you use the shortcode in a do_shortcode() function. You can add some code to your template that will take care of that. There’s some example code in the documentation:

https://eventespresso.com/wiki/events-calendar-add-on/#ee4customizations


rahmanmemon

October 12, 2017 at 10:33 pm

Hey josh that issue is now resolved i just add filter before get_header() function .. Can you please help me out in this issue “I am getting all the post by custom query i want to show venue title on the basis of current event ID..
<?php
$posts = get_posts(array(‘post_type’=>’espresso_events’,’posts_per_page’ => 3,’suppress_filters’=>false,’espresso_event_categories’ => ‘upcoming-events’));
foreach($posts as $post){
$event_obj = $post->EE_Event;

$post_id = $event_obj->ID;
$post_object = get_post( $post_id );
$x = $post->EE_Event->first_datetime();
$start_time = $x->start_time(‘g:i a’);
$end_time = $x->end_time(‘g:i a’);
$link = $event_obj->get_permalink();
//print_r($post_object);
?>
<h2><?php echo $post_object->venue_title;?></h2>


Tony

  • Support Staff

October 13, 2017 at 2:52 am

Just to note, there’s a fair amount of repetition in your code.


//For each post, use $post
foreach($posts as $post){

//pull the event object from the post object
$event_obj = $post->EE_Event;

//Grab the post/event ID
$post_id = $event_obj->ID;

//Pull the post object, using the post ID that you just got from the event object that you just pulled from the post object?
$post_object = get_post( $post_id );

$x = $post->EE_Event->first_datetime();
$start_time = $x->start_time(‘g:i a’);
$end_time = $x->end_time(‘g:i a’);
$link = $event_obj->get_permalink();
//print_r($post_object);

To get the venue title you can use the event object to pull the venue, for that you do this:


$venues = $event_obj->venues();
$venue = reset($venues);
if( $venue instanceof EE_Venue ) {
   echo '<h2>' . $venue->name() . '</h2>';
}

Or we have helper functions that can do a lot of this for you:

EE_Registry::instance()->load_helper( 'Venue_View' );
$venue_name = EEH_Venue_View::venue_name();
if( !empty( $venue_name) ) {
    echo '<h2>' . $venue_name . '</h2>';
}


rahmanmemon

October 13, 2017 at 7:08 am

Over here you add a code to display calendar by slug i want to add class on each event by category slug is it possible?


rahmanmemon

October 13, 2017 at 7:08 am

Over here :
https://gist.github.com/joshfeck/8f1e30feae874f9092d61b8ae3bf5f74
you add a code to display calendar by slug i want to add class on each event by category slug is it possible?


rahmanmemon

October 13, 2017 at 7:19 am

in Event calendar


Tony

  • Support Staff

October 13, 2017 at 9:53 am

If I understand correctly, what you are asking for is available within the Calendar options.

Go to Event Espresso -> Calendar -> Basic Settings.

Set ‘Enable CSS for Categories’ to Yes and it will add the category slug to each events classes.


rahmanmemon

October 13, 2017 at 11:17 pm

Thanks Tony! I have one more question is it possible to display content of the Event in a div on click to the event from a calendar instead of tooltip.. I want to display content of the event in right side..


rahmanmemon

October 14, 2017 at 1:07 am

And is it possible if Events in calendar not redirect us to event detail/single page?


rahmanmemon

October 14, 2017 at 4:22 am

I am using this query but it still displaying expiry event i want to hide expiry events and displays events of current month.
<?php
$posts = get_posts(array(‘post_type’=>’espresso_events’,’show_expired’ => FALSE, ‘posts_per_page’ => 5,’suppress_filters’=>false,’order_by’ => ‘start_date’

));

foreach($posts as $post){
$event_obj = $post->EE_Event;

$post_id = $event_obj->ID;
$post_object = get_post( $post_id );
$x = $post->EE_Event->first_datetime();
$start_time = $x->start_time(‘g:i a’);
$end_time = $x->end_time(‘g:i a’);
$link = $event_obj->get_permalink();
//print_r($post_object);
?>
<h2><?php echo $post_object->post_title;?></h2>


Tony

  • Support Staff

October 16, 2017 at 2:03 am

Thanks Tony! I have one more question is it possible to display content of the Event in a div on click to the event from a calendar instead of tooltip.. I want to display content of the event in right side..

We don’t have an option to do that with the calendar, a developer may be able to add that for you. If you are not currently working with a developer you can try one of the devs listed here:

https://eventespresso.com/developers/event-espresso-pros/

And is it possible if Events in calendar not redirect us to event detail/single page?

You can set an ‘Alternative registration URL’ within the vent and the calendar will direct you to the link provided there but it depends what you are trying to do.

I am using this query but it still displaying expiry event i want to hide expiry events and displays events of current month.

get_posts() doesn’t know what show_expired is, can I ask why you are not using our models to pull the events?

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

The support post ‘Calendar Shortcode is not working’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso