How to group each 8 posts on my frontpage into a parent div container in _S
-
I am building my own theme with Underscores (_S). Currently I am using a frontpage that displays the most x recent posts. I would like to group these posts like this:
<div class="teasergroup"> <article class="post-1"></article> <article class="post-2"></article> <article class="post-3"></article> <article class="post-4"></article> <article class="post-5"></article> <article class="post-6"></article> <article class="post-7"></article> <article class="post-8"></article> <div> <div class="teasergroup"> <article class="post-1"></article> <article class="post-2"></article> <article class="post-3"></article> <article class="post-4"></article> <article class="post-5"></article> <article class="post-6"></article> <article class="post-7"></article> <article class="post-8"></article> <div>
Important for me is the grouping per 8 posts. Secondary it would be cool if the children would be enumerated.
<?php while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content', 'teaser' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; endwhile; // End of the loop. ?>
While my teaser-part looks like this:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> ... </article><!-- #post-<?php the_ID(); ?> -->
Thank you very much for your help!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to group each 8 posts on my frontpage into a parent div container in _S’ is closed to new replies.