Wordpress 如何在Jupiter主题中向我的产品单页添加自定义按钮?

Wordpress 如何在Jupiter主题中向我的产品单页添加自定义按钮?,wordpress,woocommerce,hook,Wordpress,Woocommerce,Hook,我需要添加一个自定义按钮到我的商店单页,而使用木星WordPress主题和它的商店定制。通常,我使用一个子主题并覆盖其中的WooCommerce文件夹,但由于它们有自己的布局文件,我不能这样做 有没有办法在带有挂钩的“添加到购物车”按钮下面添加一个自定义按钮?为此,首先需要启用子主题,然后将此代码添加到jupiter child/functions.php中: add_action( 'woocommerce_single_product_summary', 'my_extra_button_o

我需要添加一个自定义按钮到我的商店单页,而使用木星WordPress主题和它的商店定制。通常,我使用一个子主题并覆盖其中的WooCommerce文件夹,但由于它们有自己的布局文件,我不能这样做


有没有办法在带有挂钩的“添加到购物车”按钮下面添加一个自定义按钮?

为此,首先需要启用子主题,然后将此代码添加到jupiter child/functions.php中:

add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );

function my_extra_button_on_product_page() {
  global $product;
  echo '<div class="mk-button-container _ relative custom_shop_button block text-center ">
<a href="#LINK_TO_WHAT_YOU_WANT" target="_self" class="mk-button js-smooth-scroll mk-button--dimension-three mk-button--size-medium mk-button--corner-pointed text-color-light _ relative text-center font-weight-700 no-backface letter-spacing-1 inline"><span class="mk-button--text">Link Text</span></a>
</div>';
}

希望有帮助:)

要做到这一点,首先需要启用子主题,然后将此代码添加到jupiter child/functions.php中:

add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );

function my_extra_button_on_product_page() {
  global $product;
  echo '<div class="mk-button-container _ relative custom_shop_button block text-center ">
<a href="#LINK_TO_WHAT_YOU_WANT" target="_self" class="mk-button js-smooth-scroll mk-button--dimension-three mk-button--size-medium mk-button--corner-pointed text-color-light _ relative text-center font-weight-700 no-backface letter-spacing-1 inline"><span class="mk-button--text">Link Text</span></a>
</div>';
}

希望有帮助:)

我会试试看。谢谢:)非常感谢!它起作用了!我会试试的。谢谢:)非常感谢!它起作用了!