'; $XML .= ""; $XML .= get_ALC_API_Version(); /* comments per page */ $comments_per_page = $alc_api_options['comments_per_page']; if(empty($comments_per_page)){ $comments_per_page = DEFAULT_ITEMS_PER_PAGE; } $page = (INT)strip_tags($_GET['pg']); if(!isset($page) || $page < 1){ $offset = 0; }else{ $offset = ($page-1)*$comments_per_page; } /* post */ $post_id = (INT)strip_tags($_GET['aid']); $post = get_post($post_id); if(!empty($post)){ //echo '
';
					//print_r($category);
					//echo '
'; /* Query comments for post */ $args = array('post_id' => $post_id, 'number'=>$comments_per_page, 'offset' => $offset, 'order' => 'DESC', 'status' => 'approve'); //, 'status' => 'approve' $comments = get_comments($args); $comments_count = get_comment_count($post_id); $comments_max_page = ceil($comments_count['approved'] / $comments_per_page); $XML .= "".$comments_max_page.""; // added total page count if(!empty($comments)){ foreach($comments as $comment){ //echo '
';
						//print_r($comment);
						//echo '
'; $XML .= ""; $XML .= "".$comment->comment_ID.""; $XML .= "".$comment->comment_author.""; $XML .= "".$comment->comment_content.""; $XML .= "". mysql2date("Y-m-d H:i",$comment->comment_date).""; $XML .= ""; } wp_reset_postdata(); $XML .= "1"; $XML .= ""; }else{ $XML .= "-1"; $XML .= "No comments"; } }else{ $XML .= "-1"; $XML .= "Invaild article id"; } $XML .= "
"; header("Content-Type:text/xml"); echo $XML; ?>