Maybe there's a better way to do this. Let me explain what I have right now:
I have a custom post type (Products), and a custom taxonomy (Manufacturers).
What I have outputting so far:
Manufacturer Name 1
Product 1
Product 2
Product 3
Manufacturer Name 2
Product 1
Product 2
Product 3
This is great, except pagination is being ignored. All 20+ products are being listed, BUT the page links are working.
My code:
<ul class="product-listing list-unstyled">
<?php
$categories = get_terms('manufacturer');
foreach($categories as $category) : ?>
<li class="row">
<div class="col-xs-12">
<h3><?php echo $category->name; ?></h3>
</div>
</li>
<?php
$posts = get_posts(array(
'post_type' => 'product',
'taxonomy' => $category->taxonomy,
'term' => $category->slug,
'posts_per_page' => 10,
));
foreach($posts as $post):
setup_postdata($post); ?>
<li class="row">
<div class="col-xs-12 product-copy">
<h5><a href="<?php the_permalink(); ?>">
<?php echo $category->name.' - '.get_the_title(); ?>
</a></h5>
<p><?php echo wp_trim_words( get_the_content(), 35 ); ?> <a href="<?php the_permalink(); ?>">Read More</a></p>
</div>
</li>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
I've been staring at this code for too long, and trying different solutions. Any tips?