Answer the question
In order to leave comments, you need to log in
Why post layout interferes with woocommerce layout?
When I pull the layout for the detailed product page, for some reason, the woocommerce layout is added inside the containers from the usual single post.
I throw divs on VP hooks like this:
<?php
add_action('woocommerce_before_single_product_summary', 'coffe_start_wrapper_product', 5);
function coffe_start_wrapper_product()
{
?>
<section class="banner-bottom-wthreelayouts py-lg-5 py-3">
<div class="container">
<div class="inner-sec-shop pt-lg-4 pt-3">
<div class="row">
<?php
}
add_action('woocommerce_after_single_product_summary', 'coffe_after_single_product_img_start', 25);
function coffe_after_single_product_img_start()
{
?>
</div>
</div>
</div>
</section>
<?php
}
add_action('woocommerce_before_single_product_summary', 'coffe_before_single_product_summary_start', 5);
function coffe_before_single_product_summary_start()
{
?>
<div class="col-lg-4 single-right-left ">
<div class="grid images_3_of_2">
<?php
}
add_action('woocommerce_before_single_product_summary', 'coffe_after_single_product_end', 70);
function coffe_after_single_product_end()
{
?>
</div>
</div>
<?php
}
add_action('woocommerce_single_product_summary', 'test', 0);
function test()
{
?>
<div class="col-lg-8 single-right-left simpleCart_shelfItem">
<?php
}
add_action('woocommerce_single_product_summary', 'coffe_after_single_product_entry_end', 70);
function coffe_after_single_product_entry_end()
{
?>
</div>
<?php
}
<header class="entry-header">
<?php
if ( is_singular() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
endif;
Answer the question
In order to leave comments, you need to log in
The problem was that in functions.php you need to declare that the theme supports WooCommerce. The code is like this:
add_action('after_setup_theme', 'mytheme_add_woocommerce_support');
function mytheme_add_woocommerce_support() {
add_theme_support('woocommerce');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question