I am trying to create a slider with taxonomy post categories and its Posts so the structure will look like this

Row 1
    First Category Title
      First category Post Title Goes Here
    Second Category Title
      Second category Post Title Goes Here
Row 2
    Third Category Title
      Third category Post Title Goes Here
    Fourth Category Title
      Fourth category Post Title Goes Here

So what i tried currently for getting the taxonomy category and its posts is teh below snippet

<div class="clientsListWrapper">
                        $post_type = 'clients';
                        $taxonomies = get_object_taxonomies(array( 'post_type' => $post_type));
                        foreach($taxonomies as $taxonomy) :
                            $terms = get_terms($taxonomy);
                            foreach($terms as $term) : ?>
                              <li><a><?php echo $term->name; ?></a>
                                $args = array(
                                    'post_type' => $post_type,
                                    'posts_per_page' => -1,  //show all posts
                                    'tax_query' => array(
                                            'taxonomy' => $taxonomy,
                                            'field' => 'slug',
                                            'terms' => $term->slug,
                                $posts = new WP_Query($args);
                                if($posts->have_posts()): ?>
                                <?php  while($posts->have_posts() ) : $posts->the_post(); ?>
                                    <li><a><?php  echo get_the_title(); ?></a></li>
                                <?php endwhile; endif; ?>
                            <?php endforeach;

But could not manage to create the separating part with a li or div so i wrap every row in a div or li.

ANy ideas how i achieve this?

Read more here: Wrap an X amount of taxonomy posts in a separate Row in WordPress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: