Avatar of Alicia St Rose
Alicia St Rose
Flag for United States of America

asked on 

display posts from current taxonomy archive and post with current AND second taxonomy term in same archive

I've got a taxonomy called event-category and another called event-tag.

I'm using the taxonomy-event-tag.php to display any events that are tagged with a specific term. In addition to being tagged they are also given an event-category past-events. The current events show up in the loop in the template. I'd like to have an additional section below that displays past events that share the current tax term.

the taxonomies are event-category and event-tag.

I'm about to pull my hair out trying to figure this out. Been on Google for hours. I'm missing a key understanding, I'm sure. If some one can get me started in the right direction, I'd  love it!!

I've got the follow code:

<?php $args = array(
    'posts_per_page' => -1, 
    'post_type' => 'event',  
    'tax_query' => array(
        'relation' => 'AND'
        array(
            'taxonomy' => 'event-tag',  
            'field' => 'slug',
            'terms' => array(
                'MAT' //I need this to be the term of the current taxonomy!
            )
        ),
        array(
            'taxonomy' => 'event-category',   
            'field' => 'slug',
            'terms' => array(
                'past-events'
            )
			    ),
			  )
			); ?>

Open in new window


I need the event-tag term to be the term of the current taxonomy. That's where I'm stuck.
WordPressPHP

Avatar of undefined
Last Comment
Alicia St Rose

8/22/2022 - Mon