Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

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 called event 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):

<?php
/*
* See: httphttps://wordpress.stackexchange.com/questions/1447/
*
*/
include "wp-load.php";
global $wpdb;
header('Content-Type:application/json');
$events = array();
$result = new WP_Query('post_type=event&posts_per_page=-1');
foreach($result->posts as $post) {
  $events[] = array(
    'title'   => $post->post_title,
    'start'   => get_post_meta($post->ID,'_start_datetime',true),
    'end'     => get_post_meta($post->ID,'_end_datetime',true),
    'allDay'  => (get_post_meta($post->ID,'_all_day',true) ? 'true' : 'false'),
    );
}
echo json_encode($events);
exit;

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:

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 called event 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):

<?php
/*
* See: http://wordpress.stackexchange.com/questions/1447/
*
*/
include "wp-load.php";
global $wpdb;
header('Content-Type:application/json');
$events = array();
$result = new WP_Query('post_type=event&posts_per_page=-1');
foreach($result->posts as $post) {
  $events[] = array(
    'title'   => $post->post_title,
    'start'   => get_post_meta($post->ID,'_start_datetime',true),
    'end'     => get_post_meta($post->ID,'_end_datetime',true),
    'allDay'  => (get_post_meta($post->ID,'_all_day',true) ? 'true' : 'false'),
    );
}
echo json_encode($events);
exit;

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:

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 called event 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):

<?php
/*
* See: https://wordpress.stackexchange.com/questions/1447/
*
*/
include "wp-load.php";
global $wpdb;
header('Content-Type:application/json');
$events = array();
$result = new WP_Query('post_type=event&posts_per_page=-1');
foreach($result->posts as $post) {
  $events[] = array(
    'title'   => $post->post_title,
    'start'   => get_post_meta($post->ID,'_start_datetime',true),
    'end'     => get_post_meta($post->ID,'_end_datetime',true),
    'allDay'  => (get_post_meta($post->ID,'_all_day',true) ? 'true' : 'false'),
    );
}
echo json_encode($events);
exit;

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:

Source Link
MikeSchinkel
  • 37.5k
  • 14
  • 116
  • 132

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 called event 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):

<?php
/*
* See: http://wordpress.stackexchange.com/questions/1447/
*
*/
include "wp-load.php";
global $wpdb;
header('Content-Type:application/json');
$events = array();
$result = new WP_Query('post_type=event&posts_per_page=-1');
foreach($result->posts as $post) {
  $events[] = array(
    'title'   => $post->post_title,
    'start'   => get_post_meta($post->ID,'_start_datetime',true),
    'end'     => get_post_meta($post->ID,'_end_datetime',true),
    'allDay'  => (get_post_meta($post->ID,'_all_day',true) ? 'true' : 'false'),
    );
}
echo json_encode($events);
exit;

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: