Support

Home Forums Events Calendar Add-on Calendar: Start Display for a month in the future

Calendar: Start Display for a month in the future

Posted: December 19, 2013 at 10:18 am

Viewing 6 reply threads


Mike Tidmore

December 19, 2013 at 10:18 am

I need to embed the calendar on a specific page of the site but have the first month that shows to be March of 2014. How would I do that? Can I add some parameter to the shortcode?

Thanks!

  • This topic was modified 11 years ago by Dean. Reason: moved to calendar forum


Josh

  • Support Staff

December 19, 2013 at 12:02 pm

Hi Mike,

Update: EE4 has a shortcode parameter that lets you start the display for a month in the future:
https://eventespresso.com/wiki/events-calendar-add-on/#ee4usage

While there is not a shortcode parameter for EE3’s calendar that does this, you can add one line of code to change the first month that gets displayed. This is for the current version of the calendar plugin: v.2.1:

Another Update:

Newer versions of WordPress have the wp_add_inline_script() functions, so no need to alter the calendar’s code directly as previously mentioned. Instead, you add this code to your website:

https://gist.github.com/joshfeck/18dc736a58c2f95ca1858293cfea7e6e

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.

Note that January = 0, so March is 2.

The function reference:

http://arshaw.com/fullcalendar/docs/current_date/gotoDate/

  • This reply was modified 7 years, 12 months ago by Josh. Reason: updates
  • This reply was modified 7 years, 12 months ago by Josh. Reason: Updates


Mike Tidmore

December 19, 2013 at 1:09 pm

Thanks for the speedy reply!… I haven’t actually tried this yet
But….

That sounds like it would work fine for my page March.html where I want it to start with the March view; but What about my APRIL.html page where I want to start the calendar view on that page with April being first in view?

Won’t that line of code make every iteration of the calendar start in March throughout the rest of my site? -Not what I’m trying to accomplish-

Sorry to be a pain!

Thanks again,
-Mike


Dean

December 20, 2013 at 1:35 am

Hi Mike,

That’s correct, modifying the code in that way will make every instance of the calendar go to that page.

However, looking at this it is quite simple to add in a shortcode parameter to change the behaviour.

https://gist.github.com/Apina/8051946 Does that. it requires a line change in the espresso-calendar.php (it provides the full file) and also a line added to the espresso_calendar.js, hopefully the instructions are clear.

I will make a request (though I cannot guarantee it will be accepted) for this or something similar to be added to the core calendar.


Mike Tidmore

December 20, 2013 at 10:09 am

Thanks for the Dean. Looks like that should do it. I’ll jump in. I’m pretty code shy; do you think the best way to approach this is to just replace the entire contents of my espresso-calendar.php file with the contents of the post you sent me to? Or just pull out the line I need from it?

Also, i guess this means future updates to the plugin will probably break this customization, correct? That is, until you guys build it in anyway, huh?

By the way, thanks for the new updates to the calendar from a couple of days ago. You guys really improved the look and feel of it!

Thanks again,
Mike


Dean

December 22, 2013 at 11:55 pm

Hi Mike,

If you are using version 2.1 of the calendar you can just copy all the code and replace it in the espresso-calendar.php file.

The JavaScript will need to be added to the other file as well, the same place Josh told you to place it, but this line si a little different to the one Josh suggested.

$('#espresso_calendar').fullCalendar( 'gotoDate', eeCAL.custom_year, eeCAL.custom_month);

It looks like my suggestion is being considered for future calendar updates, but yeah if you update the calendar and the feature hasn’t been added you will lose the changes made.

Thanks for the feedback over the calendar, and I’m really happy you like it, we have tried to make it cleaner and faster


Mike Tidmore

December 24, 2013 at 6:13 am

Thanks again Dean. Got it.

Viewing 6 reply threads

The support post ‘Calendar: Start Display for a month in the future’ 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