首页 文章

在woocommerce登录模板中创建链接

提问于
浏览
0

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

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模板文件中 .

我想将“送货和结算”字样更改为“用户注册”页面的链接 . 不知怎的,我无法让它发挥作用 . 是因为它在数组中的消息中吗?任何帮助表示赞赏 .

1 回答

  • 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号 .

相关问题