duanqu9292 2018-02-12 08:04
浏览 84
已采纳

无法将痕迹样式应用于woocommerce网站的所有页面

I have a woocommerce site and storefront child theme.

I changed wc-template-functions.php file to have

if ( ! function_exists( 'woocommerce_breadcrumb' ) ) {

/**
 * Output the WooCommerce Breadcrumb.
 *
 * @param array $args Arguments.
 */
function woocommerce_breadcrumb( $args = array() ) {
    $args = wp_parse_args( $args, apply_filters( 'woocommerce_breadcrumb_defaults', array(
        'delimiter'   => '',
        'wrap_before' => '<ul class="woocommerce-breadcrumb">',
        'wrap_after'  => '</ul>',
        'before'      => '<li>',
        'after'       => '</li>',
        'home'        => _x( 'Home', 'breadcrumb', 'woocommerce' ),
    ) ) );

    $breadcrumbs = new WC_Breadcrumb();

    if ( ! empty( $args['home'] ) ) {
        $breadcrumbs->add_crumb( $args['home'], apply_filters( 'woocommerce_breadcrumb_home_url', home_url() ) );
    }

    $args['breadcrumb'] = $breadcrumbs->generate();

    /**
     * WooCommerce Breadcrumb hook
     *
     * @hooked WC_Structured_Data::generate_breadcrumblist_data() - 10
     */
    do_action( 'woocommerce_breadcrumb', $breadcrumbs, $args );

    wc_get_template( 'global/breadcrumb.php', $args );
}
}

I tried to apply a new css style in my breadcrumbs, through Additional CSS and all seemed ok.

https://bestfamily.gr/shop/tech/%CF%85%CF%80%CE%BF%CE%BB%CE%BF%CE%B3%CE%B9%CF%83%CF%84%CE%AD%CF%82/laptop/acer/acer-a315-21-987x-amd/

But not all pages? posts? have the new styled breadcrumb.It exists only in pages with products.

https://bestfamily.gr/%CF%84%CF%81%CF%8C%CF%80%CE%BF%CE%B9-%CF%80%CE%BB%CE%B7%CF%81%CF%89%CE%BC%CE%AE%CF%82-2/

Simple pages, Cart, Checkout do not accept my style. WHY?

All other pages have a vertical! breadcrumb

How to apply my css style to all

Thank you

  • 写回答

1条回答 默认 最新

  • douzong5473 2018-02-12 09:29
    关注

    replace this code in your header.php

    $body_class .=' woocommerce';
    <body <?php body_class($body_class); ?>>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制