Home Forums WoodMart support forum How to select header for specific product category

How to select header for specific product category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #271631

    serezart
    Participant

    Hi,

    I want to display specific header for choosed a category by me. Can I choose headers for the category page as in the page properties?

    Attachments:
    You must be logged in to view attached files.
    #271678

    Hello,

    Try to add the following PHP code snippet to the child theme functions.php file to do this. Replace ids 10 and 11 with your categories ids and header_576762 with header ids.

    add_filter(
    	'woodmart_get_current_header_id',
    	function ( $id ) {
    		if ( is_product_category() && is_object( get_queried_object() ) ) {
    			if ( get_queried_object()->term_id == 10 ) {
    				return 'header_576762';
    			} elseif ( get_queried_object()->term_id == 11 ) {
    				return 'header_496420';
    			}
    		}
    		return $id;
    	}
    );

    Best Regards

    #271718

    serezart
    Participant

    Thank you!

    Regards

    #271876

    You are welcome! If you have any questions please feel free to contact us.

    We will appreciate highly if you spend a couple of minutes and answer the questions provided here: https://8uehqcg4tjy.typeform.com/to/IgyV2EiP

    Best Regards

    #272796

    serezart
    Participant

    Hi support,

    Thank you for your support. I have a another question.

    I made the header selection for the category. So, how can I choose a different header when entering the products in this category?

    Regards

    #272835

    Hello,

    Product pages have the option to set the header globally: in the Theme Settings > Product page.

    There is no option to set different headers for the different products.

    Best Regards

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