• Resolved purva24

    (@purva24)


    I want to target specific product category and change the dimensions of featured image which is being displayed as the product’s display image on the page. I do not want dimensions of products displayed under other categories to be affected.
    How can I do that?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • You need to check with current taxonomy details (term id or term name).

    get_queried_object()->term_id;
    OR
    $taxonomy = get_queried_object();
    $current_tax = $taxonomy->term_id;

    Get your term details by term name based for custom taxonomy.
    $term = get_term_by('name', 'metal-idols', 'prod_tax'); // replace them with correct/appropriate values

    check if current taxonomy/category equals what we get in $term, then you can change dimensions for that product else go on with current dimensions.

    for example :

    
    if($current_tax == $term->term_id) {
    	// These parameters will be for particular category/taxonomy
    	$width = '';
    	$height = '';
    } else {
    	$width = '';
    	$height = '';
    }
    

    You can use dimensions or code in if else condition the way you need to use.

    Thread Starter purva24

    (@purva24)

    Thanks for the help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Target specific product category page’ is closed to new replies.