woocommerce教程菜鸟教程woocommerce编辑帐户简码

JasperAI 10000字免费额度试用

我在这个问题中看到可以从我的订单页面创建一个简码,我正在尝试创建类似于通过简码显示编辑帐户页面的东西。

参考:在 woocommerce 中,是否有用于查看所有订单的简码/页面?

function shortcode_my_orders( $atts ) { extract( shortcode_atts( array( 'order_count' => -1 ), $atts ) ); ob_start(); wc_get_template( 'myaccount/my-orders.php', array( 'current_user' => get_user_by( 'id', get_current_user_id() ), 'order_count' => $order_count ) ); return ob_get_clean(); } add_shortcode('my_orders', 'shortcode_my_orders'); 

我创建了这个短代码来添加的 HTML 内容 编辑帐户 另一页中的一页。 我相信这就是你所要求的。

// Paste this in the function.php file of your active child theme or theme. function wc_customer_edit_account_html_shortcode( $atts ) { // Attributes extract( shortcode_atts( array( 'text' => 'Edit Account' ), $atts ) ); return wc_get_template_html( 'myaccount/form-edit-account.php', array( 'user' => get_user_by( 'id', get_current_user_id() ) ) );; } add_shortcode( 'wc_customer_edit_account_html', 'wc_customer_edit_account_html_shortcode' ); 

你也可以把它放在 新片段 在 Snippets 插件中,而不是编辑 函数.php 页。

您可以使用以下代码在任何需要的地方显示编辑帐户表单:

function clket_edit_account_form(){ ob_start(); wc_get_template( 'myaccount/form-edit-account.php', array( 'user' => get_user_by( 'id', get_current_user_id() ) ) ); return ob_get_clean(); } add_shortcode('clket_edit_account', 'clket_edit_account_form'); 

短代码: [clket_edit_account]

参考:https://woocommerce.wp-a2z.org/oik_api/wc_shortcode_my_accountedit_account/

5分钟生成10篇英文软文article forge软件试用

siteground guangda

原文链接:https://www.wordpresshy.com/330976

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享