dongruyan4948 2017-12-02 11:02
浏览 298

将Woocommerce my-account页面重定向到另一个页面

I want to display a custom wordpress page at the "my-account" page. (Only display it if the user is logged in).

if user is not logged in, it should show the standard Login / Register. That's ok.

Right now, the my-account page, after logging in, shows the standard "From your account dashboard you can view your recent orders, manage your shipping and billing addresses and edit your password and account details." message.

I don't want that. I want users to land on a completely different wordpress page if they are logged in and visit "my-account".

Thanks, Jo

  • 写回答

1条回答 默认 最新

  • dsfe167834 2017-12-02 12:03
    关注

    You can create a new shortcode for that.

    <?php 
    add_shortcode('woocommerce_my_account_custom','woocommerce_my_account_custom');
    function woocommerce_my_account_custom(){
    if (!is_user_logged_in()) return do_shortcode('[woocommerce_my_account]');
    else {
    $custompage=get_post(ANOTHER_PAGE_ID);//different page ID which contains custom data for logged in users
    echo apply_filters('the_content',$custompage->post_content);
    }
    }
    

    And then replace [woocommerce_my_account] shortcode with [woocommerce_my_account_custom].

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度