Home Forums WoodMart support forum Theme Update Product Layout Affected

Theme Update Product Layout Affected

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

    ignitionstudio
    Participant

    I have been leveraging the “extra content” placed “before” on products so that the category title carries over so the user sees consistent page flow… The issue after the latest update to the theme has the content being slightly rearranged. The extra content before is not being placed before the sidebar and so now the sidebar is moved slightly higher and over the content. My ask in support is how do we resolve this because simple css position options are not working. But also, if it would be easier to add the category title to the single product page instead of using the extra content to display an html block is an option, that would be greatly appreciated solution. Then the category titles carry over into the products and I can eliminate the extra content. You can see in my screenshots the current live site has the extra content bar above the main content and sidebar. But following the update to the theme, the other screenshot shows now how the sidebar is over the extra content.

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

    Artem Temos
    Keymaster

    Hello,

    Try to remove the extra content and add the following code snippet to the functions.php file in the child theme instead

    add_action( 'woodmart_after_header', function () {
    	global $product;
    
    	if ( ! $product ) {
    		return;
    	}
    
    	$terms = get_the_terms( $product->get_id(), 'product_cat' );
    
    	if ( ! $terms ) {
    		return;
    	}
    
    	$terms_array = array();
    	$parent      = array();
    	$child       = array();
    
    	foreach ( $terms as $term ) {
    		$terms_array[ $term->term_id ] = $term;
    
    		if ( ! $term->parent ) {
    			$parent[ $term->term_id ] = $term->name;
    		}
    	}
    
    	foreach ( $terms as $term ) {
    		if ( $term->parent ) {
    			unset( $parent[ $term->parent ] );
    
    			if ( array_key_exists( $term->parent, $terms_array ) ) {
    				$child[ $term->parent ] = get_term( $term->parent )->name;
    			}
    
    			$child[ $term->term_id ] = $term->name;
    		}
    	}
    
    	$terms = $child + $parent;
    
    	$title_class  = '';
    	$title_class .= ' title-size-' . woodmart_get_opt( 'page-title-size' );
    	$title_class .= ' title-design-' . woodmart_get_opt( 'page-title-design' );
    	$title_class .= ' color-scheme-' . woodmart_get_opt( 'page-title-color' )
    
    	?>
    	<div class="wd-page-title page-title page-title-default <?php echo $title_class; ?>">
    		<div class="container">
    			<h1 class="entry-title title"><?php echo array_shift( $terms ); ?></h1>
    		</div>
    	</div>
    	<?php
    } );

    Kind Regards

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