【问题标题】:How do I link my products directly to external in Woocommerce shop page and conserve the shop page display?如何将我的产品直接链接到 Woocommerce 商店页面中的外部并保存商店页面显示?
【发布时间】:2014-05-09 12:37:24
【问题描述】:

我正在尝试通过单击产品图片将我的 Woocommerce 商店页面上的产品直接链接到外部/附属网站。 在 content-product.php 文件中我改变了

    <a href="<?php  the_permalink(); ?>">

通过

    <a href="<?php echo esc_url( $product->get_product_url() ) ?>">

它可以工作,但会更改商店页面显示:仅显示 7 种产品中的一种,并且更改了照片尺寸。 http://i.imgur.com/Q97qhKI.jpg

请问有人有窍门吗?提前致谢!

【问题讨论】:

  • 我在他们的文档中没有看到任何提到 Product 对象的 get_product_url() 方法的内容。您是否使用扩展程序来允许会员跟踪?还是您自己将自定义字段添加到产品页面?

标签: wordpress woocommerce


【解决方案1】:

你可以试试这个,对我有用!!

add_action('plugins_loaded','your_function_name');
function your_function_name() {

   add_action('woocommerce_before_shop_loop_item','new_link_opening',10);

}
function new_link_opening() {

    echo '<a href="http://www.google.com" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-18
    • 2017-10-09
    • 2017-06-24
    • 2014-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多