• I’m trying to determine if WordPress can do the following or if this is something for a plugin or jquery module like such as Isotope.

    I would like a page on which all the post titles are listed (there will only be about 15) alongside a list of categories or tags that acts as a filter. Click on a category and only those posts titles in that category will remain in the list. click on those post titles to go to the single post page. I basically want to achieve something similar to the filter setup on this page:

    http://www.fullstopnewparagraph.co.uk/work/

    My hunch is to try it with Isotope or similar, but maybe it can be achieved by modifying the archive template

Viewing 1 replies (of 1 total)
  • If you don’t mind the page reloading then this is pretty easy if you have an understanding of WP_query and a bit of php?

    Just:

    $args = array('posts_per_page' => -1, 'post_type' => 'page');
    
    		if($taxquery != ''){
    			$args['tax_query'] = $taxquery;
    		}
    
    		$my_query = new WP_Query($args);
    
            while ($my_query->have_posts()) : $my_query->the_post();
            the_title();
            endwhile;

    Will list out all ya posts

    Add something like this at the top above that:

    if($_GET['catfilt'] != ''){
    		$taxquery = array('tax_query' => array(array('taxonomy' => 'whatevertaxonomy','field' => 'slug','terms' => $_GET['catfilt'])));
    		//print_r($_POST);
    
    	}else{
    		$taxquery = '';
    	}

    Then you just have another bit of code list out the terms:

    $terms = get_terms( 'whatevertaxonomy' );
     if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
         echo '<ul>';
         foreach ( $terms as $term ) {
           echo '<li>' . $term->name . '</li>';
    
         }
         echo '</ul>';
     }

    In the

    <li> bit just link to the same page

    echo '</li>
    <li><a>ID . '>' . $term->name . '</a></li>
    ';

    Thats the idea anyway sorry its a bit of a rushed example 😀

Viewing 1 replies (of 1 total)
  • The topic ‘post-title list and category filter’ is closed to new replies.