例如:我想在一个单独的PHP文件运行wp_query一个Ajax调用
<?php $numposts = $_POST['showposts']; ?>
<?php $home_query_bottom = new WP_Query("cat=&showposts=$num_posts&offset=5"); $b = 0; ?>
<ul class="thumbs">
<?php while ($home_query_bottom->have_posts()) : $home_query_bottom->the_post();
$do_not_duplicate = $post->ID; $b++; ?>
<li class="post-<?php the_ID(); ?> thumb"><?php get_the_image(array('custom_key' => array('thumbnail'), 'default_size' => 'thumbnail', 'width' => '160', 'height' => '160')); ?></li>
<?php endwhile; wp_reset_query(); $b = 0; ?>
</ul>
上面的代码是对自己的PHP文件准备由主WordPress的页面调用,但是我得到一个错误说wp_query类未找到。我假设这是因为我没有使用header.html,它可能有一堆包含。那个页面需要什么来利用wp_query类?
包括我的标题?但这是一个阿贾克斯电话,我想加载到我的主页 – Adam 2011-01-09 20:48:05