drngnh708353 2017-03-14 20:19
浏览 80
已采纳

未在Woocommerce存档和单个产品页面上加载样式表,使其无法格式化

I've encountered an interesting problem on one of my client's Woocommerce archive and single product pages.

For some reason, no stylesheet is loading at all on these pages and they are completely unformatted. Oddly enough, the stylesheets seem to be loading on the cart and checkout page just fine. This is a pretty basic store, all I really need is the default Woocommerce stylesheets to load for now.

Archive: http://lifeserveltd.com/online/shop/

Single Product Example: http://lifeserveltd.com/online/product/1-life-story/

From my research, I came across two possible answers online and implemented them both with no luck yet.

The first possible fix I came across suggested putting <?php body_class(); ?> inside the <body> tag like this in header.php:

<body <?php body_class(); ?>>

I can confirm that this is done.

The second solution involves editing the woocommerce.php file by wrapping the

<?php woocommerce_content(); ?> in a <div class="woocommerce"></div>

Unfortunately, the people in the articles didn't share the exact syntax they used so I tried a couple different ways of "wrapping". Here is what I tried. (I'm new to wordpress development so don't laugh too hard):

<div class="woocommerce"><?php woocommerce_content(); ?></div>


<div class="woocommerce" <?php woocommerce_content(); ?>></div>


<div class="woocommerce"><?php woocommerce_content(); ?> PAGE CONTENT </div>

1) Am I doing this right?

2) If so, what else could cause the stylesheets not to load?

I will post the articles referencing solutions in the comments because I have reached my link limit.

Thanks in advance for anyone who puts time into helping me with a solution. I deeply appreciate your time and effort and will find a way to pay it forward somehow.

  • 写回答

1条回答 默认 最新

  • dongqin1861 2017-03-14 21:40
    关注

    It looks like you are missing the header of the page, in your woocommerce.php are you making sure to call get_header(); at the top? Here are some links for reference:

    https://codex.wordpress.org/Function_Reference/get_header https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题