troubleshooting Question

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

Avatar of Alicia St Rose
Alicia St RoseFlag for United States of America asked on
WordPressPHP
7 Comments2 Solutions347 ViewsLast Modified:
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.
ASKER CERTIFIED SOLUTION
Alicia St Rose
WordPress Dev & WordPress Coach

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros