Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show posts in current category and specific tag Reply To: Show posts in current category and specific tag

#13798
Tom
Keymaster

Maybe this will work? If so, we can look into including primary categories etc..

$terms = get_the_terms( get_the_ID(), 'category' );

if ( !empty( $terms ) ){
    // get the first term
    $term = array_shift( $terms );
    $term_slug = $term->slug;
}

$args = array(
    'tax_term' => $term_slug,
    'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'category',
            'field'    => 'slug',
            'terms'    => array( $term->slug ),
        ),
        array(
            'taxonomy' => 'post_tag',
            'field'    => 'slug',
            'terms'    => array( 'new' ),
        ),
    ),
);

wpsp_display( 1234, $args );