admin管理员组文章数量:1122832
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
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
Share Improve this question edited May 26, 2018 at 21:10 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked May 26, 2018 at 20:38 RafRaf 11 bronze badge 1 |1 Answer
Reset to default 0Have reviewed your code but could not get what actually is wrong with the code.
Another possible solution is that, you can use third-party WordPress plugin WP Full Calendar and select your post type in the plugin settings. You can then use short-code to display the full calendar in any of your website page/post.
WP FullCalendar: https://wordpress.org/plugins/wp-fullcalendar/
本文标签: custom post typesload wordpress events into full calendar jquery
版权声明:本文标题:custom post types - load wordpress events into full calendar jquery 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736281927a1926479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
include
statement by arequire
, so that the script breaks if it cannot find the filewp-load.php
And finally, you could add these two lines after therequire
:ini_set('display_errors', 1);
andini_set('error_reporting', E_ALL);
. – Mike Commented May 27, 2018 at 14:50