I want to load the new entries without reloading the page.
I found a great solution for:
The ajax script:
<script>
$(document).ready(function() {
var refreshId = setInterval(function()
{
$('#content').fadeOut("fast").load('http://neocsatblog.mblx.hu/new.php').fadeIn("fast");
}, 10000);
});
</script>
And the 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>
However, this is a special feature that works perfectly here:
http://neocsatblog.mblx.hu/test/
However, the main page refuses to load new entries, I do not understand the reason for this, as we use everything the same.
Try changing your script to this since you’re not actually running a cross-browser request:
UPDATE: Wrapped in WP-friendly jQuery no-conflict code…
WordPress loads jQuery in NoConflict mode.
Do not use
$
. UsejQuery
or one of the other solutions in the Codex, like this one:Nothing will work until you sort that out.