私のWordpressページの1つ(実際には画像ブログサイト)で、Wordpress関数get_postsとともにmasonry.jsを使用して、ブログ投稿へのすべての添付ファイルをダンプし、グリッドに表示しています。これは正常に機能します。ただし、明らかに多くの画像があり、これでinfinitescroll.jsを使用したいと思っていました。唯一の問題は、ループの外側にあるget_posts関数がページネーションを保持しないため、infinitescroll.jsの機能が機能しないことです。
すべての添付ファイルをダンプするために使用しているコードは次のとおりです。
<?php
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null );
$attachments = get_posts( $args );
if ($attachments) {
foreach ( $attachments as $post ) {
setup_postdata($post);
the_attachment_link($post->ID, true);
the_excerpt();
}
}
?>
ループの外で元のWordpress添付ファイルダンプにページネーションを追加する方法はありget_posts()
ますか、それとも誰かが解決策を考えることができますか?