如何在产品页面上创建品牌名称 - 使用短代码,插件 - wooCommerce的插件

发布于 2025-02-11 11:03:45 字数 302 浏览 1 评论 0原文

我正在使用平坦的主题,必须设计自定义产品页面。我正在为WooCommerce插件使用品牌。我通过[product_brands_info type ='name']获得了标题上方的品牌名称。但是我希望它可以单击,以便将其重定向到特定的品牌页面。请帮助 http://artpoint.edupox.com/product/product/untitled-4/

I am using flatsome theme and have to design custom product page. I am using Brands for Woocommerce plugin. I got the Brand name above the Title through [product_brands_info type=’name’]. But I want it to be clickable so that it should redirect to the specific brand page. Pls help
http://artpoint.edupox.com/product/untitled-4/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫腻 2025-02-18 11:03:45

我已经检查了插件,似乎没有与此快捷代码链接的选项,但是在此简码中,您可以使用这两个操作轻松添加代码。这些动作将在短装内容之前和之后起作用。

将这些代码添加到激活的主题的函数中。php文件。如果您愿意,也可以在< a>标签中添加target =“ _ blank”,因为它是外部链接。

add_action('product_brands_info_before', 'add_brand_link_start');
function add_brand_link_start($term){
    $brand_url  = get_term_meta( $term->term_id, 'br_brand_url', true );
    ?>
    <a href="<?php echo esc_url($brand_url); ?>">
    <?php
}

add_action('product_brands_info_after', 'add_brand_link_end');
function add_brand_link_end($term){
    ?>
    </a>
    <?php
}

确保您在管理面板中添加了品牌URL,请参阅屏幕截图 https://prnt.sc/_yauhdokaqccd 。希望它对您有用。

I have checked the plugin and seems there is no options for linking with this shortcode but in this shortcode you can easily add codes using these two actions. These actions will work before and after the shortcodes content.

Add these codes in your activated theme's functions.php file. If you want you can also add target="_blank" in the <a> tag as it is an external link.

add_action('product_brands_info_before', 'add_brand_link_start');
function add_brand_link_start($term){
    $brand_url  = get_term_meta( $term->term_id, 'br_brand_url', true );
    ?>
    <a href="<?php echo esc_url($brand_url); ?>">
    <?php
}

add_action('product_brands_info_after', 'add_brand_link_end');
function add_brand_link_end($term){
    ?>
    </a>
    <?php
}

Make sure you have added brand url in the admin panel, please see the screenshot https://prnt.sc/_YaUhdokAQCd . Hope it will work for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文