1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Wordpressで無限スクロールを設定

Last updated at Posted at 2017-06-21

表題の通り、投稿記事を無限スクロールで表示させる方法。

読み込みファイル

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.1.0/jquery.infinitescroll.min.js"></script>

オプション設定

<script type="text/javascript">
  jQuery(function(){
    jQuery('#column-content').infinitescroll({
      loading: {
        finishedMsg: "",
        msgText: "<span class='message_text'>読み込み中</span>"  //最後の項目の後にはカンマを付けない
       },
      navSelector  : ".column-pagenavi",     // ナビゲーション要素を指定
      nextSelector : ".column-pagenavi a", // ナビゲーションの「次へ」の要素を指定
      itemSelector : ".entry-column-item"   // 表示させる要素を指定
    });
  });
</script>

表示側

<div class="column-pagenavi">
  <?php posts_nav_link(); ?>
</div>
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?