Forums

Group Posts by Taxonomy on Category pages (2 posts)

  1. sabahat
    Member
    Posted 8 months ago #

    Hello,

    I need some major help with this. I want to be able to display posts on the category template in groups, not just a straight list. for example, I want to be able to click on 'Architecture' (as the category), and when it opens up, all articles under this category should be further sorted into 'Books', 'Articles' and 'Reports'.

    Does anyone know if this is possible, or has anyone implemented anything like this before? I've searched both this forum and google, but either I'm not using the correct terminology for the search, or noone has actually done this before (which is hard to believe!).

    I'd appreciate any help possible.

  2. sabahat
    Member
    Posted 8 months ago #

    I found this in the codex:

    $args = array(
    	'tax_query' => array(
    		'relation' => 'OR',
    		array(
    			'taxonomy' => 'category',
    			'field' => 'slug',
    			'terms' => array( 'quotes' ),
    		),
    		array(
    			'taxonomy' => 'post_format',
    			'field' => 'slug',
    			'terms' => array( 'post-format-quote' )
    		)
    	)
    );
    $query = new WP_Query( $args );

    But if I use this, do I create a custom template for each category, of which there are going to be lots?

Reply

You must log in to post.

About this Topic