/** * Gets a an array containing all the data required to create an WP_Remote_Posts_Item instance; * @param int $remote_item_id */ private static function get_data($remote_item_id) { $local_data = array(); //TODO: This is where you might grab the item from your DB. I currently have this abstracted out to a seperate class. $remote_data = WP_Remote_Posts_Data_Api::get_post_data($remote_item_id); if (!empty($remote_data)) { $local_data['ID'] = $remote_data['ID']; $local_data['title'] = apply_filters('the_title', $remote_data['title']); $local_data['content'] = apply_filters('the_content', $remote_data['content']); $local_data['permalink'] = get_site_url() . '/remote-posts/' . $remote_data['ID']; } return apply_filters('wp_remote_posts_get_model_data', $local_data, $remote_item_id); }
<?php get_header(); ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <h1>Your Remote Post Archive</h1> <p>Modify the WP_Remote_Posts_Data_Api class to get the real data from your remote feed.</p> <p>The data below is just mocked up in the WP_Remote_Posts_Data_Api class as of now</p> <?php $items_data = WP_Remote_Posts_Data_Api::get_posts_data(); ?> <ul> <?php foreach ($items_data as $item_data) { ?> <?php $item = WP_Remote_Posts_Item::get_instance($item_data['ID']); ?> <li><a href="<?php echo $item->permalink; ?> "><?php echo $item->title; ?> </a></li> <?php } ?>