douwei9973
2018-09-20 14:22
浏览 33
已采纳

仅在Woocommerce中编辑产品标签存档页面的痕迹

I have found where in WooCommerce (WC) I can edit directly to get my desired result, which is editing the following function: https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-breadcrumb.php#L222

private function add_crumbs_product_tag() {
        $current_term = $GLOBALS['wp_query']->get_queried_object();
        $this->prepend_shop_page();
        /* translators: %s: product tag */
        $this->add_crumb( sprintf( __( 'My Edit: %s', 'woocommerce' ), $current_term->name ), get_term_link( $current_term, 'product_tag' ) );
    }

Now I know that it is bad practice to directly edit the WC plugin, so I am looking for an alternative, so that when WC updates, the changes aren't overwritten.

Override Attempt

I have tried to add my edited class to my child theme (mytheme-child/woocommerce/includes/class-wc-breadcrumb.php) but this doesn't seem to work.

What can I do?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题