Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
    Posts
  • #1292004

    Hello,
    for seo needs I would like to add a description to my product categories, but I see that the text goes in the wrong place, in the title header.
    Anyway to fix that?

    category description in a wrong place

    thank you!

    #1292646

    Hey marcie73,

    Thank you for the inquiry.

    Where would you like the description to display? The overview banner is created using the wp-content/themes/enfold/config-woocommerce/config.php file > avia_woocommerce_parallax_banner function, which is located around line 1143. The actual description is located around line 1179.

    if($description) $output .= "
    <h1>".$description."</h1>
    ";
    

    Best regards,
    Ismael

    #1293107

    Hello, in the main.template-shop as a paragraph is possible?
    So it will be displayed at the top before the product list.
    Thank you!

    #1293110

    I have a further question, how do i display a title header here
    https://www.officinadeiricordi.it/shop/
    as appears automatically in the product category template?
    https://www.officinadeiricordi.it/categoria-prodotto/vetrina-affettatrici-volano-berkel/

    I mean, the h1 is missing completely and should be present.
    Thank you!

    • This reply was modified 3 years, 8 months ago by marcie73.
    #1293444

    Hi,

    Thank you for the update.

    Hello, in the main.template-shop as a paragraph is possible?

    What do you mean by “main.template-shop as a paragraph”? Please explain it further or provide a screenshot.

    The shop title is actually there but it is hidden using css. To display it back use this css code.

    .template-shop .page-title {
        display: block;
        position: absolute;
        top: 50px;
    }
    
    header.woocommerce-products-header + .template-shop {
        margin-top: 50px;
    }
    

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

    #1293520

    Hello,
    I think your code is not correct because template-shop is the content below, and the page-title is outside and before it.
    What I meant for main.template-shop is actually the container you mention in your css.

    View post on imgur.com


    ps: sorry the screenshot is of a category page, not of the shop page, that’s why you see a header title. It does no matter since the .template-shop appears in both.
    Thank you!

    • This reply was modified 3 years, 8 months ago by marcie73.
    #1293917

    Hi,

    Thank you for following up.

    Did you actually try the css code? That should display back the hidden shop title container as shown in the screenshot below.

    // https://imgur.com/nAO9GCl

    Best regards,
    Ismael

    #1295212

    Now I see there is another div with the same class, anyway it is a title occupying the width o the central content , excluded the sidebar. It is not full width as the product category (you can see one posted above).
    Thanks!

    View post on imgur.com

    #1295685

    Hi,

    It is not full width as the product category

    What do you mean? Are you trying to implement a banner style title container in the shop page same as in the category or archive pages? If that is the case, then go to the Enfold > Shop Options panel, then enable the Main Shop Page Banner option.

    Thank you for your patience.

    Best regards,
    Ismael

    #1296507

    Hello,
    thank you to show me how to add the banner in the shop page, it is something I wanted to do for a long time.
    But the initial request is another one.
    I would like to add a description in product categories.
    As you pointed out the description is set in the banner inside an h1 tag,

    if($description) $output .= ”
    <h1>”.$description.”</h1>
    “;

    In there it should be placed the category title, while the description should be placed below inside the “main” element with class “template-shop” and “content”. Just before the product list.

    Don’t you think?
    This should allow to have category pages optimized for seo
    Hope you get my point.
    Thank you!

    • This reply was modified 3 years, 7 months ago by marcie73.
    #1296697

    Hi,

    The description should display automatically when the Enfold Child Category Styling is set to Default. Please try to edit one of the product categories and look for the styling just below the Thumbnail option.

    Best regards,
    Ismael

    #1296718

    I saw the option but the result is not making really sense (see link with screenshot)

    View post on imgur.com


    While now I have description in right place, the title is the shop title and not the category title.
    The title should be the one that now is shown as description, which I left very short because used to appear in the banner inside h1.
    Thank you!

    • This reply was modified 3 years, 7 months ago by marcie73.
    #1296884

    Hi,

    Can we access the site? We would like to check how the product categories are setup and inspect the theme options. Please post the login details in the private field.

    Best regards,
    Ismael

    #1296958

    Hello!
    ok I added them in the private content.
    thank you!

    #1297296

    Hi,

    What you see in the screenshot below is the value of the Shop Description field, and it can be edited in the Enfold > Shop Options panel.

    Screenshot: https://imgur.com/a/FvuyqMO

    If you want to see the title there, just edit the Shop Description and place the actual title of the shop page.

    For the archive pages, if you want to include the category title there, try to modify the enfold/config-woocommerce/config.php file, look for the avia_woocommerce_parallax_banner function and around line 1180, look for this code.

    if($description) $output .= "".$description."";
    

    Replace it with:

    $output .= "<h1>".get_the_archive_title()."</h1>";
    if($description) $output .= "<p>".$description."</p>";
    

    Best regards,
    Ismael

    #1297544

    Hi Ismael,
    i tried your code (which now is removed but you can see screenshot showing the results)
    – category title is placed in right placed but it has a suffix “category:” that i would like to remove
    – description should be placed in the other “main” below the banner. Both containers have same classes, and maybe this is the reason we don’t understand each other ;).
    – I tried putting a folder named config-woocommerce and inside config.php in the child theme, but it does not work,
    next Enfold update I will lose the customization, anyway I think this should a obvious thing to change in your theme.

    View post on imgur.com

    Thank you for support!

    #1297874

    Hi,

    – To remove the “Category:” prefix, use this in the functions.php file.

    add_filter("get_the_archive_title_prefix", "__return_empty_string");
    

    – If you want to move the description back to its original place, remove this line from the avia_woocommerce_parallax_banner function.

    if($description) $output .= "".$description."
    
    ";
    

    Add this code in the functions.php file.

    
    add_action("after_setup_theme", function() {
        add_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
        add_action( 'woocommerce_product_archive_description', 'woocommerce_product_archive_description', 10 );
    }, 20);
    

    After that, use this css code to remove the default page thumbnail.

    .tax-product_cat .page-thumb {
        display: none !important;
    }
    

    – You cannot override a config file in the child theme directory.

    Best regards,
    Ismael

    #1297961

    Hello Ismael,
    ok i f I cannot rewrite config.php it must be found a piece of code to be put in child functions.php doing all the following:
    1) remove description in title banner
    2) adding category title (+ stripping prefix).
    3) adding description inside template-shop element

    I see that you added description before the template-shop element, when it should be inside.
    This creates a full width element pushing down both the template-shop element and the sidebar, which is not correct.
    The description should be inside the 2/3 width element, and the sidebar should always adjacent to the title banner.
    Please see screenshot.

    Hope you understand. This is they way it is supposed to be designed.
    and hope it is possibile to achieve.
    Thank you!

    View post on imgur.com

    #1298218

    Hi,

    It is possible to override the avia_woocommerce_shop_banner and avia_woocommerce_big_cat_banner functions by copying them in your child theme’s functions.php file before doing your modifications such as removing the description and adding the title as we described above. You should also rename the functions to something else, you can add a suffix or prefix to the current function name so that it does not conflict with the original functions.

    And make sure to remove the action hook where the functions are currently attached to.

    Example:

    remove_action( 'ava_after_main_container', 'avia_<a href='https://refer.wordpress.com/r/84/woocommerce/' target='_blank' rel="nofollow">woocommerce</a>_big_cat_banner', 11 );
    remove_action( 'ava_after_main_container', 'avia_<a href='https://refer.wordpress.com/r/84/woocommerce/' target='_blank' rel="nofollow">woocommerce</a>_shop_banner', 11 );
    

    Full example can found in these threads.

    // https://kriesi.at/support/topic/product-category-pages-full-width-page-banner-and-description/#post-560335
    // https://kriesi.at/support/topic/product-category-pages-full-width-page-banner-and-description-updated/#post-877483

    This creates a full width element pushing down both the template-shop

    You should be able to adjust it with css. Or try to replace the woocommerce_archive_description and woocommerce_product_archive_description hook with woocommerce_before_shop_loop.

    Best regards,
    Ismael

    #1298310

    hello Ismael,
    sorry I’m not a php programmer and I struggle a bit..
    The function I need to change should be “avia_woocommerce_parallax_banner”

    I cannot find corresponding terms in your below lines:
    remove_action( ‘avia_after_main_container’, ‘avia_woocommerce_big_cat_banner’, 11 );
    remove_action( ‘avia_after_main_container’, ‘avia_woocommerce_shop_banner’, 11 );

    Should I write:
    remove_action( ‘avia_after_main_container’, ‘avia_woocommerce_parallax_banner’, 11 );
    add_action(‘avia_after_main_container’,’my_function_avia_woocommerce_parallax_banner’, 11);
    function my_function_avia_woocommerce_parallax_banner ( $bg, $overlay, $opacity, $description, $font ) {
    // same function but with 1180 row changed?
    }
    ______
    For description location, with woocommerce_before_shop_loop, now it is in the right place! :)
    thanks

    View post on imgur.com

    • This reply was modified 3 years, 7 months ago by marcie73.
    #1298715

    Hi,

    We added this snippet in the functions.php file to replace the description with the actual product archive title.

    
    add_action( 'init', 'avia_woocommerce_full_width_category_images', 50 );
    function avia_woocommerce_full_width_category_images()
    {
       	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_big_cat_banner_child_theme', 11);
    	//add_action( 'ava_after_main_container', 'avia_woocommerce_shop_banner_child_theme', 11);
    
    	function avia_woocommerce_shop_banner_child_theme()
    	{
    		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($bg, $overlay, $opacity, $description, $font);
    			}
    		}
    	}
    
    	function avia_woocommerce_parallax_banner_child_theme($bg, $overlay, $opacity, $description, $font)
    	{
    
    		if(is_numeric($bg))
    		{
    			$bg = wp_get_attachment_image_src($bg, 'full');
    			if(is_array($bg) && $bg[0] != "") $bg = $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" 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">';
    		$output .= "
    <h1>".get_the_archive_title()."</h1>
    ";
    		if(false) $output .= "
    <h1>".$description."</h1>
    ";
    		$output .='</main></div>
    </div>
    </div>
    ';
    
    		return $output;
    	}
    
    	function avia_woocommerce_big_cat_banner_child_theme()
    	{
    		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 			= get_woocommerce_term_meta($term->term_id, 'av_cat_styling');
    					$attachment_id 	= get_woocommerce_term_meta($term->term_id, 'thumbnail_id');
    
    					$overlay 	= get_woocommerce_term_meta($term->term_id, 'av-banner-overlay');
    					$font 		= get_woocommerce_term_meta($term->term_id, 'av-banner-font');
    					$opacity 	= 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_child_theme($attachment_id, $overlay, $opacity, $description, $font);
    						$avia_config['woo-banner'] = true;
    					}
    				}
    			}
    		}
    	}
    }
    
    

    Best regards,
    Ismael

    #1298905

    Finally it seems to work!
    And it was quite hard to develop with my knowledge, so thank you.

    I recommend to take into account to update your theme, because the description in the title banner does not make any sense.
    No one would be able to use category products for SEO purpose.

    #1299285

    Hi,

    Glad it is working. We will forward the issue to our channel, see if we can do any changes in the next patch. We will close the thread for now. Please feel free to open another if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

    #1300303

    Hello Ismael,
    regarding the description that now is in right place, In added the function below, but the html editor gives me a warning of sintax error and in the debug log file I have this other warning
    [14-May-2021 09:08:40 UTC] PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘woocommerce_before_shop_loop’ not found or invalid function name in /home/

    // ADD PRODUCT CATEGORY DESCRIPTION IN RIGHT PLACE
    add_action(“after_setup_theme”, function() {
    add_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_taxonomy_archive_description’, 10 );
    add_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_before_shop_loop’, 10 );
    }, 20);

    Do you see anything wrong?
    Thank you!

    #1300768

    Hi,

    The hook works fine on our end. Please try this again.

    // ADD PRODUCT CATEGORY DESCRIPTION IN RIGHT PLACE
    add_action("after_setup_theme", function() {
    	add_action( "woocommerce_before_shop_loop", "woocommerce_taxonomy_archive_description", 10 );
    	add_action( "woocommerce_before_shop_loop", "woocommerce_before_shop_loop", 10 );
    }, 20);
    

    Open a new thread if this continues to be an issue and post the site details again in the private field. We will close this one for now because the thread becoming a bit too long.

    Thank you for your patience.

    Best regards,
    Ismael

Viewing 25 posts - 1 through 25 (of 25 total)
  • The topic ‘woocommerce category description displayed in title header’ is closed to new replies.