• I have a filter gallery as part of a theme that I’ve modified per my clients instructions. He wanted instead of “ALL” posts showing on page load, a category page named “Selects”. I hard coded the nav menu as follows:

    <ul class="filter">
    <li><a class="active" href="#" data-filter=".selects">Selects</a></li>
    <li><a href="#" data-filter=".television">Television</a></li>
    <li><a href="#" data-filter=".feature">Feature</a></li>
    <li><a href="#" data-filter=".commercial">Commercial</a></li>
    </ul>

    The code that displays the menu items is as follows:

    <?php
    $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    $args = array(
    'posts_per_page' => -1,
    'offset'=> 0,
    'post_type' => 'portfolio');
    $all_posts = new WP_Query($args);
    while($all_posts->have_posts()) : $all_posts->the_post();
    ?>

    If I try to add the 'category' => 'selects' I get a blank page. Is there a way to load the page without showing ALL of the posts but rather the first link?

    Thanks
    P

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter PDidee

    (@pdidee)

    Oh and here is the javascript:

    $(document).ready(function(){
     var $container = $('#portfolio .items');
    	$container.imagesLoaded( function(){
    		$container.isotope({
    			itemSelector : '.item',
    			layoutMode : 'fitRows'
    		});
    	});
    
    	$('.filter li a').click(function(){
    
    		$('.filter li a').removeClass('active');
    		$(this).addClass('active');
    
    		var selector = $(this).attr('data-filter');
    		$container.isotope({ filter: selector });
    
    		return false;
    	});
    });

    Thread Starter PDidee

    (@pdidee)

    Figured this out! If anyone is interested this link helped a lot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter Gallery still shows "ALL" posts…’ is closed to new replies.