Posted: July 15, 2013 at 3:31 am
|
Hi there, I’m trying to display a day view calendar but I need the shortcode to display the view of a particular event day by default and not the current date. Any help is appreciated. Cheers Bhanu Chawla |
|
Hi, It is possible to do this, but it requires editing a core files in the calendar add on whihc we do not recommned. Any updates to the add on will over write the changes. If you still wish to do this, then in the calendar add on, edit the espresso-calendar.php file. Approx line 850 (based on calendar 2.0.6.1) you will see the following code: if( ee_parentHeight < ee_newHeight ) { ee_newHeight = ee_newHeight + 30; dayCnt.parents('tr').height( ee_newHeight ).css({ 'height' : ee_newHeight + 'px' }); } } }); }, ee_imgTimeout ); }); Change the code so that it reads this: if( ee_parentHeight < ee_newHeight ) { ee_newHeight = ee_newHeight + 30; dayCnt.parents('tr').height( ee_newHeight ).css({ 'height' : ee_newHeight + 'px' }); } } }); }, ee_imgTimeout ); $('#espresso_calendar').fullCalendar('gotoDate', 2013, 2, 21); }); In this new piece of code the date is represented as 2013, 2, 21 (year, month, day). Please note that the Month starts at 0, so January is 0, February is 1, etc. |
|
Hi Dean, Thanks a lot for this. But what if I need another shortcode for a different date. I just need 2 calendar days in total here. Let me know if that’s possible. Cheers |
|
Hi Aaron, Not possible to my knowledge, at least not without customising the calendar shortcode and javascript to basically create a new function (set date). I will add this to the feature request list but cannot guarantee inclusion. If it is something paramount to your business needs I would suggest contacting one of our recommended developers to see if its something they can custom build for you – https://eventespresso.com/developers/event-espresso-pros/ |
|
Hi Dean, What about if we can customize the code for an existing shortcode (let’s say month view) to display date view of a particular date? This way I can use day view and month view and they’ll display 2 different events. Let me know what you think? Also, where do I need to replace the code for the month shortcode. Cheers |
|
Hi Aaron, The [ESPRESSO_CALENDAR] shortcode uses the same code base, regardless of view type, so you would have to create a completely new shortcode. It would be better in my opinion to extend the shortcode and add in a new attribute, for example [ESPRESSO_CALENDAR start_date=”2013-07-02″] but as mentioned that would require some customisation of the calendar add on, as you would need to modify several of the files. I don’t believe it will be something we will include just yet, however it has potential to be included when we re-write the calendar add on for 4.X though of course I cannot promise its inclusion. If you were to modify the plugin to show the month change which would show on every calendar, the changes need to go in espresso-calendar.php which is located in the espresso-calendar folder in the plugins folder. |
|
Hi Dean, I tried the code change above and tried using [ESPRESSO_CALENDAR] on a page but it’s still displaying the default date. Could you please tell me what’s the issue here? Cheers |
|
Hi, Can you paste your espresso-calendar.php into a Pastebin, that will allow me to see what you have done. |
|
There you go, Dean: http://pastebin.com/tMZDXy4F |
|
That is correct, it works for me. What version of Event Espresso, the Calendar and importantly jQuery are you using? Have you cleared your cache after changing the code? |
|
Cache sorted out the issue. Thanks! Just a quick one, can’t we put an if statement in the same code so that your code changes the date depending on page IDs? |
|
Good thinking! var pathname = window.location.pathname; console.log(pathname); if(pathname == "/calendar/") { $('#espresso_calendar').fullCalendar('gotoDate', 2013, 10, 13); } else if(pathname == "/calendar2/") { $('#espresso_calendar').fullCalendar('gotoDate', 2013, 0, 13); } else {} |
|
Well, that sorted my problem. 🙂 Thanks for your help Dean. |
The support post ‘Day view for a particular day’ 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.