Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1371548

    Hi,

    I want to change the site logo on some product pages.

    The following code only works on classic pages but not on product pages.

    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if(is_page( array(595, 1056, 1097, 1138, 1067, 1424, 63) ) )
        {
        $logo = "URL";
        }
    
        return $logo;
    }

    Any idea how to make this work?

    Alex

    #1371582

    Hey Alex,

    You should be able to use the is_product conditional instead: https://stackoverflow.com/questions/67500402/woocommerce-conditional-is-product-from-functions-php

    Best regards,
    Rikard

    #1371639

    Thanks for your help Rikard,

    I use this code, but is not working , this changes the logo for all products.

    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if(is_product( array(595, 1056, 1097, 1138, 1067, 1424, 63) ) )
        {
        $logo = "URL";
        }
    
        return $logo;
    }

    How to have different logos for the products?

    #1371655

    Hi,
    This is working in my test on our Shop Demo for single product pages:

    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if(is_single( array(595, 1056, 1097, 1138, 1067, 1424, 63) ) )
        {
        $logo = "URL";
        }
    
        return $logo;
    }

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.