[Closed] How to create a calendar to show events.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 26 replies, has 4 voices.

Last updated by Christian Cox 5 months, 2 weeks ago.

Assigned support staff: Christian Cox.

Author
Posts
#1393223

Tell us what you are trying to do?
Hi, I have created an Events CPT where there are start and end datetime fields.
Now, I need to create a calendar, that I put it in a sidebar or in the footer with a shortcode, where the days that has an event are linkable to the day archive page where are listed all the events of that day.
Similar to the Toolset Maps, where I can display the marker of all "posts" that has a location field.
So, now I can display only the calendar with a single event CPT post, but I want and I need to dispaly the calendar with all Event CPT posts.
What should I do to do that?

Is there any documentation that you are following? I don't know

Is there a similar example that we can see? I don't know

What is the link to your site? the site is under development in a local machine.

#1393487

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi, there isn't a calendar-style display built into Views right now so it would require a significant amount of custom code with PHP, HTML and CSS. I don't have any code snippets available to help create this, as it would be rather complex...it is really a completely new feature. We plan to create a calendar display for Views, but it's not ready yet. We've asked for some feedback on our blog about displaying posts on a calendar: https://toolset.com/2019/06/do-you-need-calendar-view-for-toolset/
If you'd like to see a calendar added, this is the place to submit your comments. Amir will take everything into consideration while planning the new calendar View.

#1394913

Hi Christian,
Thank you, but I cannot write my comment because the discussion is closed.

But, if I select to show the date field value, I can choose the calendar option (see the attached image), but I can display in the calendar only the post date. But it is strange to have this option for a single post and not for all posts date field like as maps.

#1398983

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

The problem isn't displaying a single date on a calendar. The problem is displaying multiple dates from multiple posts on the same calendar. It is not possible in Views.

#1399301

Hi francesco,
i may be able to help with custom code i had a similar issue i resolved with shortcode to display calendar of CPT .

francisco

#1399487

Hi Francisco,
can you help me sending me the custom code that you have used?
Thank you!!!

#1400723

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I'll leave this ticket open in case more discussion is needed.

#1400903

Thank you Christian.

Francisco, are you here? Can you hlep me?

#1401261

Yes , francesco i cant put all the codes here. first need to create a post form 'Calendar' ,remove all cred fields . this the form
to put on thepage.

In the form just need div element with an id, is the wrapper for the calendar:
<div id="calendar"></div>

Initialize in the form or JS editor:
<script>
$(function() {

// var title = $("input[name='post_title']").val();

$('#calendar').eCalendar({
ajaxDayLoader : "/wp-content/plugins/hb-shortcodes/hg-days-sql.php",
ajaxEventLoader : "/wp-content/plugins/hb-shortcodes/hg-events-sql.php",
eventsContainer : "#hb-event-list",
currentMonth : 10,
currentYear : 2019,
startMonth : 1,
startYear : 2019,
endMonth : 12,
endYear : 2020,
title : title,
firstDayOfWeek : 1,
onBeforeLoad : function() {} ,
onAfterLoad : function() { },
onClickDay : function() {}

});

});

</script>
also i need to know the fields of cpt Event post ,start date to adjust the sql. then we can install rest of the script.

#1404391

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hello Francesco, just checking to be sure you received the latest message from Francisco.

#1405743

Hi, sorry,
I see now the reply, I don't have received the email notification.

Thank you Francisco for your tip&tricks.

The fields of cpt Events are: "data-inizio", "data-fine" and "indirizzo". The two date fields are "datetime" fields.

Then, why "first need to create a post form 'Calendar' and remove all cred fields and this the form
to put on thepage"? Why I cannot create a widget or a shortcode?

#1407659

Hi francesco
shortcode is already created for you by post form [cred_form form="calendar"] . can try view shortcode [wpv-view name="calendar"]. remove cred fields is so shortcode just display calendar , you not need to add data.
On post form clicking on days can link to events.

#1408459

Hi Francisco,
thank you.

So, I don't need to use the datetime fields value in the code?
and, in the following part of your previous code, I cannot use dynamic value? They need to be changed manually?
currentMonth : 10,
currentYear : 2019,
startMonth : 1,
startYear : 2019,
endMonth : 12,
endYear : 2020,

#1410105

Hi Francesco
You need to use datetime values to get the event days of each month to display on calendar. for the code yes need to changed manually.

#1413475

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hello, I'm commenting again so the system will keep the thread open for discussion.

The topic ‘[Closed] How to create a calendar to show events.’ is closed to new replies.