Support

Home Forums Event Espresso Premium Day view for a particular day

Day view for a particular day

Posted: July 15, 2013 at 3:31 am

Viewing 12 reply threads


Aaron Davies

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


Dean

July 15, 2013 at 3:48 am

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.


Aaron Davies

July 15, 2013 at 3:52 am

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


Dean

July 15, 2013 at 4:31 am

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/


Aaron Davies

July 15, 2013 at 4:33 am

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


Dean

July 15, 2013 at 5:02 am

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.


Aaron Davies

July 15, 2013 at 7:21 am

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


Dean

July 15, 2013 at 7:28 am

Hi,

Can you paste your espresso-calendar.php into a Pastebin, that will allow me to see what you have done.


Aaron Davies

July 15, 2013 at 7:29 am

There you go, Dean: http://pastebin.com/tMZDXy4F


Dean

July 15, 2013 at 7:33 am

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?


Aaron Davies

July 15, 2013 at 7:40 am

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?


Dean

July 15, 2013 at 7:53 am

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 {}


Aaron Davies

July 15, 2013 at 7:57 am

Well, that sorted my problem. 🙂

Thanks for your help Dean.

Viewing 12 reply threads

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.

Event Espresso