コード例 #1
0
 public function on_template_include($template)
 {
     global $wp_query;
     if (isset($wp_query->query_vars['wp_remote_posts_id']) && !empty($wp_query->query_vars['wp_remote_posts_id'])) {
         if ($wp_query->query_vars['wp_remote_posts_id'] == 'all') {
             $file = 'archive-remote-post.php';
         } else {
             $item = WP_Remote_Posts_Item::get_instance((int) get_query_var('wp_remote_posts_id'));
             if (empty($item)) {
                 $file = 'single-remote-post-404.php';
             } else {
                 $file = 'single-remote-post.php';
             }
         }
         //Look in your theme for single-remote-post.php and wp-remote-posts/single-remote-post.php
         $template = locate_template(array_unique(array($file, WP_Remote_Posts::get_template_directory() . $file)));
         if (!$template) {
             $template = WP_Remote_Posts::get_plugin_path() . '/templates/' . $file;
         }
     }
     return $template;
 }
コード例 #2
0
<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 
}
?>
		</ul>

	</div>
</div>
コード例 #3
0
<?php

get_header();
?>

<div id="primary" class="content-area">
	<div id="content" class="site-content" role="main">
		<?php 
$item = WP_Remote_Posts_Item::get_instance((int) get_query_var('wp_remote_posts_id'));
?>
		<h1><?php 
echo $item->title;
?>
</h1>
		<?php 
echo $item->content;
?>
	</div>
</div>

<?php 
get_sidebar();
get_footer();