-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax_blog.php
More file actions
44 lines (35 loc) · 1.07 KB
/
Copy pathajax_blog.php
File metadata and controls
44 lines (35 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
/*
* ajax_request.php
* ----------------
* Request image information for a post in the blog. Returns a json object to
* the browser for use in the JavaScript code.
*/
require_once('../../../wp-config.php');
$id = intval($_GET['id']);
query_posts('p='.$id);
while(have_posts()) {
the_post();
$next_post = get_next_post();
$prev_post = get_previous_post();
// Grab post information.
ob_start();
the_content();
$content = ob_get_clean();
$info = array(
'image_uri' => get_thumbnail(true),
'post_content' => $content,
'post_title' => $post->post_title,
'post_date' => get_the_time('jS F Y'),
'permalink' => get_permalink($post->ID),
'next_post' => $next_post ? $next_post->ID : 0,
'prev_post' => $prev_post ? $prev_post->ID : 0,
'next_post_perm' => $next_post ? get_permalink($next_post->ID) : '',
'prev_post_perm' => $prev_post ? get_permalink($prev_post->ID) : '',
'comment_status' => $post->comment_status,
'comment_count' => $post->comment_count,
'exif' => get_exif(),
);
echo json_encode($info);
}
?>