我想在不重新加载页面的情况下加载新条目
我找到了一个很好的解决方案:
ajax脚本:
<script>
$(document).ready(function() {
var refreshId = setInterval(function()
{
$(\'#content\').fadeOut("fast").load(\'http://neocsatblog.mblx.hu/new.php\').fadeIn("fast");
}, 10000);
});
</script>
和php:<?php require_once("wp-blog-header.php"); ?>
<div id="content" <?php cyberchimps_filter_content_class(); ?>>
<?php do_action( \'cyberchimps_before_content\'); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( \'content\', get_post_format() ); ?>
<?php endwhile; ?>
<?php elseif ( current_user_can( \'edit_posts\' ) ) : ?>
<?php get_template_part( \'no-results\', \'index\' ); ?>
<?php endif; ?>
<?php do_action( \'cyberchimps_after_content\'); ?>
</div>
然而,这是一个在这里非常有效的特殊功能:http://neocsatblog.mblx.hu/test/然而,主页拒绝加载新条目,我不明白原因是什么,因为我们使用的都是一样的。