Skip Navigation

[Résolu] Events for a calendar

This support ticket is created Il y a 8 années et 4 mois. There's a good chance that you are reading advice that it now obsolete.

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 10 réponses, has 2 voix.

Last updated by Pat Il y a 8 années et 2 mois.

Assigned support staff: Paweł Pela.

Auteur
Publications
#233133

Pat

Hello,
I'm working on a site with reservation feature and would like to know if there is a possibility to manage this with Types & Views.
My idea is to create a postype (Event) and create new events for a specfic date (or a group of specific dates).
The quesiton is : is it possible to link these events to a calendar in order to display all events in a calendar ?
Regards
Pat

#233194

Dear Pat,

There are a couple things to consider:

1. What Calendar will you actually be using, as each one has it's own specific ways to do things.

2. If your Calendar supports CPT's as a way to store data, then integration with Types is possible.

3. The default WordPress "calendar" widget is actually unusable in this scenario, as it has post type hardcoded (sad, but true).

4. If you want to create your own CPT-backed calendar, then it will be easy to use Types and maybe Views to display it.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Paweł

#233199

Pat

Hello Pawel,
Thanks for your answer.
Is there any way to use Google calendar for this?
Regards
Pat

#233200

Dear Pat,

This, again, depends on what you want to achieve exactly.

I'm sure there is a way to export data from Google calendar: hidden link

There is also the Google Calendar API: hidden link

This means that data can be synched between WordPress and GCal in both ways. I would suggest to look for already available plugins to either use them as is or see how their author coded a solution.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Paweł

#233385

Pat

Hello Pawel,
Thanks for the info.
I have found a calendar that seems to answer my needs :
hidden link

In order to create an input in the calendar, I need to feed the following info :

var calendar = $('#calendar').calendar({
events_source: [
{
"id": 293,
"title": "Event 1",
"url": "hidden link",
"class": "event-important",
"start": 12039485678000, // Milliseconds
"end": 1234576967000 // Milliseconds
},
...
]});

How can I do this within Toolset, taking into account that I can create custom postype (id, title) and custom fields for all other inputs.
The issue is for me to define how I can pass the info when I'm in a Cred form for creating a new event.

Regards
Pat

#233389

Dear Pat,

There are hooks available in CRED, which allow you to perform checks on the data passed in by forms: https://toolset.com/documentation/user-guides/cred-api/ Here you can handle additional data conversions etc.

I can see this calendar has a JS/jQ API, so you will need to create a View which will generate the array like this:

[wpv-layout-start]
	[wpv-items-found]
	
var calendar = $('#calendar').calendar({
events_source: [
<!-- wpv-loop-start -->
		<wpv-loop>
{
"id": [wpv-post-id],
"title": "[wpv-post-title]",
"url": "[types field="url"][/types]",
"class": "[types field="class"][/types]",
"start": [types field="startdate"][/types], // Milliseconds
"end": [types field="enddate"][/types] // Milliseconds
},
		</wpv-loop>
	<!-- wpv-loop-end -->
]});
	[/wpv-items-found]
	[wpv-no-items-found]
		[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]
	[/wpv-no-items-found]
[wpv-layout-end]

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Paweł

#236067

Pat

Hello Pawel,

Sorry but I didn't find time to check this solution for the moment. I will do this in the next days and will keep you informed of the result.
Thanks in the meantime.
Pat

#236119

Dear Pat,

Good 🙂 No problem. Just tell me if it worked and if so you can close the thread. If no, please tell me how did it go and how I can help you.

Regards,
Paweł

#239360

Pat

Hello Pawel,

Sorry but I need some more time to make the test.
I will keep you informed as soon as I'm able to do it.
Regards
pat

#239365

Dear Pat,

Sure, please test as you need it 🙂

Regards,
Paweł

#243012

Pat

Hello Pawel,

Thanks for your support.
For the moment, I have sufficient info to move forward.
I will open a new ticket if needed in the future.
Regards
Pat