theme development - the_content() not displaying description correctly

I'm trying to display a description of a WooCommerce single product, but the instead of displaying the correct desc

I'm trying to display a description of a WooCommerce single product, but the instead of displaying the correct description, the loop starts over again displaying the image, price, add to cart etc.

I've tried to find the answer for long time with no avail. I have used the WooCommerce template scripts and edit them; the_excerpt() will work but not the_content().

This is the template file I am currently using: .php

the_content() is now the problem. Could it be my query or something? I have different way to query my products from index.php, but the archive-product.php is having the same as WooCommerce query has. Could this be the cause, even if it's in the single-product.php the problem?

I use this for the front-page.php:s product loop:

<div class="col-9 main-products">
    <?php echo do_shortcode('[products paginate="true" limit="30" orderby="popularity"]'); ?>
</div>

content-single-product.php, archive-product.php and single-product.php are the same as the WooCommerce template has.

It should display the description instead of looping over again. There are no error messages.

I've also used a different theme and the products display correctly, so the problem isn't in any plugins I am using.

I'm trying to display a description of a WooCommerce single product, but the instead of displaying the correct description, the loop starts over again displaying the image, price, add to cart etc.

I've tried to find the answer for long time with no avail. I have used the WooCommerce template scripts and edit them; the_excerpt() will work but not the_content().

This is the template file I am currently using: https://github/woocommerce/woocommerce/blob/master/templates/single-product/tabs/description.php

the_content() is now the problem. Could it be my query or something? I have different way to query my products from index.php, but the archive-product.php is having the same as WooCommerce query has. Could this be the cause, even if it's in the single-product.php the problem?

I use this for the front-page.php:s product loop:

<div class="col-9 main-products">
    <?php echo do_shortcode('[products paginate="true" limit="30" orderby="popularity"]'); ?>
</div>

content-single-product.php, archive-product.php and single-product.php are the same as the WooCommerce template has.

It should display the description instead of looping over again. There are no error messages.

I've also used a different theme and the products display correctly, so the problem isn't in any plugins I am using.

Share Improve this question edited Jun 17, 2019 at 12:27 Timppa asked Jun 17, 2019 at 8:35 TimppaTimppa 1016 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0
echo wpautop(get_the_content());

This code fixed the problem! I found out the solution from here: Post content being duplicated by the_content(); by KreigD's answer.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745391901a4625699.html

相关推荐

  • theme development - the_content() not displaying description correctly

    I'm trying to display a description of a WooCommerce single product, but the instead of displaying the correct desc

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信