在woocommerce登录模板中创建链接

时间:2015-11-15 18:27:57

标签: php wordpress woocommerce

在我的网站上是一个自定义注册表单。 当新客户试图结账时,会向客户显示一个页面,说明他/她必须登录才能继续结账。他们可以点击登录链接并获取此页面:

enter image description here

当他们是新手时,他们必须注册。在上面的图像中是一个文字,用于进行“运输和结算”。部分。这只是文字。请参阅下面的代码。

<?php woocommerce_login_form( array('message' => __( 'If you have shopped with us before, please enter your details in the boxes below. If you are a new customer please proceed to the Billing &amp; Shipping section.', 'woocommerce' ), 'redirect' => wc_get_page_permalink( 'checkout' ), 'hidden' => true ) ); ?>

此代码位于form-login.php模板文件中。

我想更改单词&#34; Shipping and Billing&#34;进入我的用户注册页面的链接。不知怎的,我无法让它发挥作用。是因为它在数组中的消息中吗?任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

感谢Kharis Sulistiyono在WordPress dot org,感谢答案:

我用以下代码替换了代码:

<?php

$register_url = get_permalink('4491');

woocommerce_login_form(
array('message'  => __( 'If you have shopped with us before, please enter your details in the boxes below. </br></br><strong>If you are a new customer please <a href="'.esc_url($register_url ).'">register here</a>.</strong>', 'woocommerce' ),
    'redirect' => wc_get_page_permalink( 'checkout' ),
    'hidden'   => true
)
);

?>

其中4491是帖子/页面的ID号。