'; $XML .= ""; $XML .= get_ALC_API_Version(); $XML .= categoryListXML ($alc_api_options); // category listing /* postst per page */ $page = (INT) strip_tags($_GET['pg']); if (!isset($page) || $page < 1) { $page = 1; } $posts_per_page = $alc_api_options['posts_per_page']; if (empty($posts_per_page)) { $posts_per_page = DEFAULT_ITEMS_PER_PAGE; //get_option('posts_per_page'); } /* category */ $cat_id = (INT) strip_tags($_GET['cid']); $category = get_category($cat_id); $XML .= "".$cat_id.""; // just return selected category id //$XML .= articleListImageSizeXML($alc_api_options); // list image size if (!empty($category)) { //echo '
';
        //print_r($category);
        //echo '
'; if (in_array($cat_id, $alc_api_options['cat'])) { /* Query posts from category */ $args = array('post_type' => 'post', 'cat' => $cat_id, 'posts_per_page' => $posts_per_page, 'paged' => $page); $cat_query = new WP_Query($args); $XML .= "" . $cat_query->max_num_pages . ""; // added total page count if ($cat_query->have_posts()) { while ($cat_query->have_posts()) : $cat_query->the_post(); $XML .= "
"; $XML .= "" . get_the_ID() . ""; $XML .= "" . get_the_title() . ""; $XML .= "" . get_permalink() . ""; if (!empty($cat_query->post->post_excerpt)) { $description = $cat_query->post->post_excerpt; } else { $description = $cat_query->post->post_content; } $description = stripHtmlTags($description); $XML .= ""; $XML .= "" . get_the_time("Y-m-d H:i") . ""; $thumbnail_id = get_post_meta(get_the_ID(), '_thumbnail_id', true); $XML .= ""; if (!empty($thumbnail_id)) { $xml_thumb = wp_get_attachment_image_src($thumbnail_id, 'full'); $xml_thumb_src = get_tim_thumb($xml_thumb[0], THUMB_WIDTH_2x, THUMB_HEIGHT_2x); $XML .= $xml_thumb_src; } $XML .= ""; $XML .= "
"; endwhile; } wp_reset_postdata(); $XML .= "1"; $XML .= ""; } else { $XML .= "-1"; $XML .= "This category is prohibited for export"; } } else { $XML .= "-1"; $XML .= "Invaild category id"; } $XML .= "
"; header("Content-Type:text/xml"); echo $XML; ?>