Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何停止Wordpress插件';ajax加载更多';从复制帖子?_Php_Ajax_Wordpress - Fatal编程技术网

Php 如何停止Wordpress插件';ajax加载更多';从复制帖子?

Php 如何停止Wordpress插件';ajax加载更多';从复制帖子?,php,ajax,wordpress,Php,Ajax,Wordpress,我在我的Wordpress网站主页上显示了4篇文章,并安装了“ajax加载更多”插件,作为向我的主页添加“加载更多文章”按钮的快捷方式。但是,当您单击“加载更多”按钮时,它会加载最新的帖子,主页也会加载最新的帖子,因此您必须单击该按钮5次,才能获得尚未加载的帖子。我如何让它加载第五个最新帖子并从那里开始 以下是我的主页的Wp_查询: <?php $args = array( 'posts_per_page' => 4, '

我在我的Wordpress网站主页上显示了4篇文章,并安装了“ajax加载更多”插件,作为向我的主页添加“加载更多文章”按钮的快捷方式。但是,当您单击“加载更多”按钮时,它会加载最新的帖子,主页也会加载最新的帖子,因此您必须单击该按钮5次,才能获得尚未加载的帖子。我如何让它加载第五个最新帖子并从那里开始

以下是我的主页的Wp_查询:

<?php

        $args = array(
          'posts_per_page'   => 4,
          'offset'      => $offset
        );
        $query = new WP_Query( $args );

      ?>

<div class="container">
<div class="row">
  <div class="col-md-8 blogpost">
    <div class="blogpost2">

      <?php if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>


      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(''); ?></a>
      <div class="colour">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <p><em>
          By <?php the_author(); ?> 
          on <?php echo the_time('l, F jS, Y');?>
          in <?php the_category( ', ' ); ?>.
          <a href="<?php comments_link(); ?>"><?php comments_number(); ?></a>
          <?php the_excerpt(); ?>
        </em></p>
        <center><a id="rdm" class="readmore btn btn-default" href="<?php the_permalink(); ?>" role="button">Read More</a></center>

        </div>

      <?php endwhile; endif; wp_reset_postdata(); ?>
      </div>
    <?php if ( dynamic_sidebar( 'posts' ) ); ?>
      </div>


通过
在…上
在里面

以下是我在Ajax加载中使用的HTML和php:

<?php

        $args = array(
          'posts_per_page'   => 4,
          'offset'=> 4
        );
        $query = new WP_Query( $args );

      ?>

<div class="container">
<div class="row">
  <div class="col-md-8 blogpost">
    <div class="blogpost2">


      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(''); ?></a>
      <div class="colour">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <p><em>
          By <?php the_author(); ?> 
          on <?php echo the_time('l, F jS, Y');?>
          in <?php the_category( ', ' ); ?>.
          <a href="<?php comments_link(); ?>"><?php comments_number(); ?></a>
          <?php the_excerpt(); ?>
        </em></p>
        <center><a id="rdm" class="readmore btn btn-default" href="<?php the_permalink(); ?>" role="button">Read More</a></center>

        </div>
      </div>


通过
在…上
在里面

您可能会发现这[1]很有帮助。[1]: