load wordpress events into full calendar jquery

Question

I am trying to load my custom post type events into jquery plugin full calendar but nothing is working. I have made a php file with this code

include "wp-load.php";
global $wpdb;
header('Content-Type:application/json');
$events = array();
$result = new WP_Query('post_type=events&posts_per_page=-1');
foreach($result->posts as $post) {
$events[] = array(
'title'   => $post->post_title,
'start'   => '2018-03-12T20:00:00',

);
}
echo json_encode($events);
exit;

But its not loading anything

0
, Raf 3 years 0 Answers 71 views 0

Leave an answer