Change image header in Woocommerce category page

Home Forums Monument Valley Change image header in Woocommerce category page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18240

    martinez
    Participant

    Change image header in Woocommerce category page

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    Hello, I need to know how I can change or remove the image of the header on the page of Woocommerce product category

    The product category page is dynamic and I can not edit it.

    #18241

    Oliver Juhas
    Keymaster

    Hi martinez,

    The default intro header image can be changed in Appearance → Customize → Header Image. This image will be used on all archive pages in your website, including product category pages. Checking your website I’d say this is probably the option you are looking for.
    Tip: Please see the “Anatomy” section of theme documentation to find out more about what, where and how to set up in the theme.

    On the other hand, if you want to disable/remove the intro image on product category page only, you can do that using custom CSS:

    .tax-product_cat .intro-container {
    	background-image: none;
    }

    And finally, if you want to change the image specifically for product category pages, it is only possible using a custom PHP code in your child theme‘s functions.php file:

    function child_theme_intro_image( $image_url ) {
    	if ( function_exists( 'is_product_category' ) && is_product_category() ) {
    		// Assign default, fallback product category image
    		$image_url = 'FALLBACK_PRODUCT_CATEGORY_IMAGE_URL_HERE';
    
    		// Get the image from the product category if it is set
    		global $wp_query;
    		$cat = $wp_query->get_queried_object();
    		$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    		if ( $thumbnail_id ) {
    			$image_url = wp_get_attachment_url( $thumbnail_id );
    		}
    	}
    	return $image_url;
    }
    add_filter( 'wmhook_monument_valley_intro_background_image_url', 'child_theme_intro_image' );

    Best regards,

    Oliver Juhas
    WebMan Design

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.