Я настоящий новичок в AJAX, и мне было интересно, как я могу сделать автоматическое обновление номеров комментариев, используя jquery и AJAX в Wordpress.Спасибо за вашу помощь.Вот мой jquery:
<script>
jQuery(document).ready(function($){
setInterval( "countnumbers();", 2000);
countnumbers = function(){
$('cite.commentcount').each(function(){
$(this).load('<?php get_permalink(); ?>, <?php echo get_comments_number(); ?>');
});
} // End countnumbers function
});
</script>
Вот мой PHP:
<a href="<?php the_syndication_permalink();?>" target="_blank" class="readstory"></a>
<?php if(!is_single()) : ?>
<cite class="commentcount"><?php comments_number('0', '1', '%'); ?></cite>
<a href="<?php the_permalink();?>" class="comments"></a>
<?php endif; ?>