I managed to use Radiant Scroller to create a slider grid of posts for my custom post type (zee_work). It serves as a display of portfolio items in a very clean neat way, but I need to filter the posts in order to show all the posts (default) and any other category (that number could change if I add more categories).
The code I have is this:
<?php
$works = get_posts(
array(
'post_type'=>'zee_work',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => -1 ) );
?>
<div id="portfolio" class="clearfix">
This is the grid slider (working smooth):
<div id="myScroller">
<?php foreach ($works as $key => $work) {
?>
<div class="scroller-el">
<a href="<?php the_permalink($work->ID)?>">
<?php echo get_the_post_thumbnail( $work->ID, 'work-thumb', array(
'class' => "img-responsive",
'alt' => trim(strip_tags( $work->post_title )),
'title' => trim(strip_tags( $work->post_title ))
)); ?> </a>
</div>
<?php } ?>
</div>
</div>
How do I do a foreach of every category (custom tax) on my zee_work posts to filter the slider? I need help! :c
UPDATE
I managed to add a filter on top using isotope and the filtering works BUT the default view (all) 'hardcodes' the pagination so if for example, the first time the page loads with all the items the slider has 3 pages, the filtering that occurs next will keep 3 pages even if items fit in only one, and the items are distributed in all 3 pages so it leaves empty spaces in the grid.... oh boy...
<ul class="portfolio-filter">
<li><a class="btn btn-default active" href="#" data-filter="*">
<?php _e('All', ZEETEXTDOMAIN); ?></a></li>
<?php
$terms = get_terms('cat_work', array('hide_empty'=> true));
foreach ($terms as $term) {
?>
<li><a class="btn btn-default" href="#" data-filter=".<?php echo $term->slug ?>"><?php echo $term->name ?></a></li>
<?php
}
?>
</ul>