Here is a question I have spent over 3 hours attempting to solve but each approach I take ends up not working out for me.
All I am attempting to do is utilize this opensource ajax calendar script:
and have the entries display all posts within a specific post type. For each of the posts within this event post type I have a custom metabox with the following custom fields:
- event category
- event start date
- event start time
- event end date
- event end time
At the most basic level I just need each post to show up within the applicable calendar box based on the “event start date” and “event start time” and link to the applicable event post details page.
In an ideal situation I was looking to have each event category with its own color and have each event span multiple days if the applicable event has an "event_end_date"
that is different than the start date.
Has anyone done this before and can past the applicable code to get either of these in place. I feel this would be highly valuable to the WordPress community as well.
FullCalendar is a nice find.
Looks to me like you’ll need to write a shortcode (which I show how to do here):
And then generate the code to call the FullCalendar within the shortcode.
After that you’ll need to write code to generate a Javascript array or have it references a JSON feed:
Here’s code you can put into a standalone
.PHP
file which you could call/fullcalendar-json-feed.php
or whatever you like. The code queries a custom post types calledevent
which will run in the root directory of your website and will generate a JSON feed and it assumes you’ve got some custom fields needed to populate the array/feed. (I’m going to leave the rest of the query and custom field details to you. Note I didn’t actually test this with FullCalendar so it might take a bit of tweaking):You can generate the array option with very similar code to that above. Still, this is going to take a bit of coding for you to get right. Maybe you just want to use a solution that’s already built? Here’s a Q&A discussion about calendars for WordPress: