I have a custom query set up that currently modifies the product category pages of my website. I would also want this code to affect the product attribute archive pages of my website, but I am having trouble with the conditional statements.
Here is the conditional statement I am using now that modifies my product category pages:
function display_custom( $query ) {
if(!is_admin() && (in_array ( $query->get('post_type'), array('product') ) || $query->get('product_cat') != '') )
{
CUSTOM QUERY GOES HERE
}
return $query;
}
add_action('woocommerce_product_query', 'display_custom',800);
I tried just using if (!is_admin())
but it didn't work.
Any pointers to make this query work on the product attribute pages?