global $post; //, $wp_query; $posts_array[$post->ID] = $post->post_type; } foreach ($posts_array as $id => $type) { $classes = 'uposts-post uposts-posts-' . $id . ' '; ?> <li <?php apply_filters('upfront_posts_post_classes', post_class($classes), $post); ?> data-post_id="<?php echo $id; ?> "> <?php echo Upfront_ThisPostView::get_post_markup($id, $type, $properties, $layout, true); ?> </li> <?php } // Clean up after this post: global $wp_query; $wp_query->is_single = false; ?> </ul> <?php if ($properties['pagination']) { ?> <div class="uposts-pagination upfront-pagination <?php echo $properties['pagination']; ?>
/** * Loads all the data needed for a single post to be edited. * @return null */ public function get_postlayout() { $post_type = isset($_POST['post_type']) ? $_POST['post_type'] : false; $type = isset($_POST['type']) ? $_POST['type'] : false; $id = isset($_POST['id']) ? $_POST['id'] : false; $post_id = isset($_POST['post_id']) ? $_POST['post_id'] : false; $properties = isset($_POST['properties']) ? $_POST['properties'] : false; if (!$post_type || !$type || !$id || !$post_id) { $this->_out(new Upfront_JsonResponse_Error('No post_type, type or id sent.')); } if (!empty($post_id)) { $post_type = get_post_type($post_id); } $layout_data = Upfront_ThisPostView::find_postlayout($type, $post_type, $id); $layout_data['partTemplates'] = stripslashes_deep(Upfront_ThisPostView::find_partTemplates($type, $post_type, $id)); $layout_data['partContents'] = $this->generate_part_contents($post_id, $layout_data['partOptions'], $layout_data['partTemplates'], false, $properties); $this->_out(new Upfront_JsonResponse_Success($layout_data)); }