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

    Hello there,
    How are you ?

    On the product category pages, the category name doesnt show up on the full width banner, but instead it’s the description who shows up (ex : https://preprod.atmosphere-monaco.com/product-category/chaussures-femmes/sneakers/). The problem seems to come from the file \config-woocommerce\config.php line 1258 (Enfold v5.2.1)

    https://preprod.atmosphere-monaco.com
    Password : Truc;123

    Thank you :)

    #1371858

    Hey seo-systeme,

    Thank you for the inquiry.

    In the code below, we modified the parallax banner function a bit to include the category title and re-registers the template hooks. Please create a site backup, then add the code below in the functions.php file.

    
    
    function avia_woocommerce_big_cat_banner_mod()
    {
    	if(is_product_category())
    	{
    		global $wp_query, $avia_config;
    
    		if(isset($wp_query->query_vars['taxonomy']))
    		{
    			$term = get_term_by( 'slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']);
    			if( ! empty( $term->term_id ) )
    			{
    				$description 	= term_description() ;
    				$style		= avia_get_woocommerce_term_meta( $term->term_id, 'av_cat_styling' );
    				$attachment_id 	= avia_get_woocommerce_term_meta( $term->term_id, 'thumbnail_id' );
    
    				$overlay 	= avia_get_woocommerce_term_meta( $term->term_id, 'av-banner-overlay' );
    				$font 		= avia_get_woocommerce_term_meta( $term->term_id, 'av-banner-font' );
    				$opacity 	= avia_get_woocommerce_term_meta( $term->term_id, 'av-banner-overlay-opacity' );
    
    				if(!empty($style))
    				{
    					remove_action( 'woocommerce_before_shop_loop', 'woocommerce_taxonomy_archive_description', 11 );
    					echo avia_woocommerce_parallax_banner_mod($attachment_id, $overlay, $opacity, $description, $font);
    					$avia_config['woo-banner'] = true;
    				}
    			}
    		}
    	}
    }
    
    function avia_woocommerce_shop_banner_mod()
    {
    	global $avia_config;
    
    	if(is_shop() || (is_product_category() && avia_get_option('shop_banner_global') == 'shop_banner_global') && !isset($avia_config['woo-banner']))
    	{
    		$options = avia_get_option();
    
    		if( isset( $options['shop_banner'] )  && ( $options['shop_banner'] == 'av-active-shop-banner' ) )
    		{
    			$bg 		= $options['shop_banner_image'];
    			$overlay 	= $options['shop_banner_overlay_color'];
    			$opacity 	= $options['shop_banner_overlay_opacity'];
    			$description= wpautop( $options['shop_banner_message'] );
    			$font 		= $options['shop_banner_message_color'];
    
    			echo avia_woocommerce_parallax_banner_mod( $bg, $overlay, $opacity, $description, $font );
    		}
    	}
    }
    
    function avia_woocommerce_parallax_banner_mod( $bg, $overlay, $opacity, $description, $font )
    {
    	if( is_numeric( $bg ) )
    	{
    		$bg = wp_get_attachment_image_src($bg, 'extra_large');
    		$bg = ( is_array( $bg ) && $bg[0] != '' ) ? $bg[0] : '';
    	}
    
    	if( $font )
    	{
    		$font = "style='color:{$font};'";
    	}
    
    	if( $bg )
    	{
    		$bg = "background-image: url({$bg});";
    	}
    
    	$output  = '';
    	$output .= '<div id="av_product_description" class="avia-section main_color avia-section-large avia-no-border-styling avia-full-stretch av-parallax-section av-section-color-overlay-active avia-bg-style-parallax container_wrap fullsize" data-section-bg-repeat="stretch" ' . $font . '>';
    	$output .=		'<div class="av-parallax avia-full-stretch" data-avia-parallax-ratio="0.3">';
    	$output .=			'<div class="av-parallax-inner av-parallax-woo" style="' . $bg . ' main_color background-attachment: scroll; background-position: 50% 50%; background-repeat: no-repeat;">';
    	$output .=			'</div>';
    	$output .=		'</div>';
    
    	$output .=		'<div class="av-section-color-overlay-wrap">';
    
    	if( ! empty( $overlay ) )
    	{
    		$output .=		'<div class="av-section-color-overlay" style="opacity: '.$opacity.'; background-color: ' . $overlay . '; "></div>';
    	}
    
    	$output .=			'<div class="container">';
    	$output .=				'<main class="template-page content av-content-full alpha units">';
    
    	if( $description )
    	{
    		$title = get_the_archive_title();
    		$output .=				"<h1>{$title}</h1>";
    		$output .=				"<p>{$description}</p>";
    	}
    
    	$output .=				'</main>';
    	$output .=			'</div>';
    	$output .=		'</div>';
    	$output .= '</div>';
    
    	return $output;
    }
    
    add_action('after_setup_theme', function() {
        remove_action( 'ava_after_main_container', 'avia_woocommerce_shop_banner', 11 );
        remove_action( 'ava_after_main_container', 'avia_woocommerce_big_cat_banner', 11 );
        add_action( 'ava_after_main_container', 'avia_woocommerce_shop_banner_mod', 11 );
        add_action( 'ava_after_main_container', 'avia_woocommerce_big_cat_banner_mod', 11 );
    }, 999);
    

    Best regards,
    Ismael

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