<?php
/**
* AjaxWp - An AJAX enchancement for Wordpress
* Copyright (c) 2006, Gianni Milanesi <gianni@giannim.com>
*
* AjaxWp is freely distributable under the terms of an MIT-style license.
* For details, see the AjaxWp web site: http://www.giannim.com/projects/ajax-wp
*
*/
$postid = $_GET['postid'];
require('../../../wp-blog-header.php');
// Load the requested posts
query_posts('p='.$postid);
include("ajax-single.php");
?>
其中ajax-single.php则为原模板single.php去掉头尾等多余内容而来:
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="entry">
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title('-image-'); ?></a></h2>
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?><br />
<?php endwhile; else: ?>
<div class="entry">
<p>Sorry, no posts matched your criteria.</p>
</div>
<?php endif; ?>
</div>