Loop multipli nella stessa pagina, senza contenuti duplicati
Sto cercando di creare una pagina con loop multipli, ho bisogno che ogni loop mostri un numero predefinito di post dalla stessa categoria (ogni loop mostra X numero di post dalla Categoria CATS). Ma ho anche bisogno che il secondo loop, il terzo loop e così via mostrino i post da dove l'ultimo loop si è fermato, senza duplicare i contenuti (esempio: loop 1 dal post 1 al 5, loop 2 dal post 6 al 10, loop 3 dal post 11 al 15 ecc.). Ecco cosa ho provato finora (Ho anche provato il codice nel codex di WordPress, ma niente sembra funzionare)
Potete aiutarmi?
Ecco il mio codice finora:
<?php if (have_posts()) : ?>
<?php $mosaics = new WP_Query('category_name=mosaics&posts_per_page=5'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php if( $post->ID == $do_not_duplicate ) continue; ?>
<?php echo get_the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<br />
<?php if (have_posts()) : ?>
<?php $mosaics = new WP_Query('category_name=mosaics&posts_per_page=4'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php if( $post->ID == $do_not_duplicate ) continue; ?>
<?php echo get_the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<br />
<?php if (have_posts()) : ?>
<?php $mosaics = new WP_Query('category_name=mosaics&posts_per_page=3'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php if( $post->ID == $do_not_duplicate ) continue; ?>
<?php echo get_the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<br />
<?php if (have_posts()) : ?>
<?php $mosaics = new WP_Query('category_name=mosaics&posts_per_page=2'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php if( $post->ID == $do_not_duplicate ) continue; ?>
<?php echo get_the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
È importante leggere questo capitolo del Codex fino alla fine, poiché i suggerimenti essenziali si trovano dopo l'intestazione 'Nota per i Post Multipli nella Prima Categoria';
codice ripetitivo e tedioso:
<?php $do_not_duplicate = array(); ?>
<?php $mosaics = new WP_Query('category_name=mosaics&posts_per_page=5'); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( 'category_name' => 'mosaics', 'posts_per_page' => 4, 'post__not_in' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( 'category_name' => 'mosaics', 'posts_per_page' => 3, 'post__not_in' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>
<br />
<?php $mosaics = new WP_Query( array( 'category_name' => 'mosaics', 'posts_per_page' => 2, 'post__not_in' => $do_not_duplicate ) ); ?>
<?php while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
<?php $do_not_duplicate[] = $post->ID; ?>
<?php echo get_the_content(); ?>
<?php endwhile; wp_reset_postdata(); ?>

Sebbene la risposta di Michael funzioni, eseguire query multiple per questo scopo è uno spreco di risorse del database quando puoi ottenere tutti i risultati con una singola query e gestire la suddivisione dell'output in PHP. Vedi questa risposta che ho dato a un'altra domanda simile per ottenere gli stessi risultati con una singola query al database.

Utilizza il parametro Offset per i cicli successivi, questo farà in modo che i post vengano visualizzati a partire dal numero che specifichi:
// parte dal post 6 al post 10
$mosaics = new WP_Query('category_name=mosaics&posts_per_page=5&offset=5');
// parte dal post 11 al post 15
$mosaics = new WP_Query('category_name=mosaics&posts_per_page=5&offset=10');
