✏️ 正在编辑: form-edit-address.php
路径:
/home/h359620/public_html/wp-content/themes/datis/woocommerce/myaccount/form-edit-address.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php if (! function_exists('datis_one_line_address')) { function datis_one_line_address($html) { $html = (string) $html; // Replace <br> with comma + space $html = preg_replace('/<br\s*\/?>/i', ', ', $html); // Remove wrapping <p> tags (common in Woo output) $html = preg_replace('/<\/?p[^>]*>/i', '', $html); // Strip remaining tags, normalize spaces $text = wp_strip_all_tags($html); $text = preg_replace('/\s+/u', ' ', $text); return trim($text, " \t\n\r\0\x0B,"); } } defined('ABSPATH') || exit; $customer_id = isset($customer_id) ? absint($customer_id) : get_current_user_id(); $load_address = isset($load_address) ? sanitize_key($load_address) : ''; // کارتها (لیست) if (empty($load_address)) : $get_addresses = apply_filters( 'woocommerce_my_account_get_addresses', array( 'billing' => esc_html_x('Billing address', 'My account address title', 'woocommerce'), 'shipping' => esc_html_x('Shipping address', 'My account address title', 'woocommerce'), ), $customer_id ); if (function_exists('wc_ship_to_billing_address_only') && wc_ship_to_billing_address_only()) { unset($get_addresses['shipping']); } $billing_value_raw = wc_get_account_formatted_address('billing'); $billing_value = datis_one_line_address($billing_value_raw); $billing_has = ($billing_value !== ''); $shipping_value_raw = wc_get_account_formatted_address('shipping'); $shipping_value = datis_one_line_address($shipping_value_raw); $shipping_has = ($shipping_value !== ''); $myaccount_url = function_exists('wc_get_page_permalink') ? wc_get_page_permalink('myaccount') : ''; $billing_edit_url = function_exists('wc_get_endpoint_url') ? wc_get_endpoint_url('edit-address', 'billing', $myaccount_url) : '#'; $shipping_edit_url = function_exists('wc_get_endpoint_url') ? wc_get_endpoint_url('edit-address', 'shipping', $myaccount_url) : '#'; ?> <div class="address-shell"> <h3 class="address-title mb-4"><?php echo esc_html_x('My addresses', 'Addresses title', 'datis'); ?></h3> <?php if (isset($get_addresses['billing'])) : ?> <div class="address-cards mb-3"> <div class="billing d-flex flex-column flex-lg-row align-items-center justify-content-between gap-4 p-4"> <div class="billing-address-meta w-100 w-lg-75"> <div class="billing-address-name"><?php echo esc_html_x('Billing address', 'Addresses card title', 'datis'); ?></div> <div class="billing-address-value"> <?php if ($billing_has) { echo esc_html($billing_value); } else { echo esc_html_x('No address has been set yet.', 'Addresses empty', 'datis'); } ?> </div> </div> <a class="billing-address-btn d-flex flex-row align-items-center justify-content-center" href="<?php echo esc_url($billing_edit_url); ?>"> <?php echo $billing_has ? esc_html_x('Edit address', 'Addresses button', 'datis') : esc_html_x('Add address', 'Addresses button', 'datis'); ?> </a> </div> </div> <?php endif; ?> <?php if (isset($get_addresses['shipping'])) : ?> <div class="address-cards"> <div class="shipping d-flex flex-column flex-lg-row align-items-center justify-content-between gap-4 p-4"> <div class="shipping-address-meta w-100 w-lg-75"> <div class="shipping-address-name"><?php echo esc_html_x('Shipping address', 'Addresses card title', 'datis'); ?></div> <div class="shipping-address-value"> <?php if ($shipping_has) { echo esc_html($shipping_value); } else { echo esc_html_x('No address has been set yet.', 'Addresses empty', 'datis'); } ?> </div> </div> <a class="shipping-address-btn d-flex flex-row align-items-center justify-content-center" href="<?php echo esc_url($shipping_edit_url); ?>"> <?php echo $shipping_has ? esc_html_x('Edit address', 'Addresses button', 'datis') : esc_html_x('Add address', 'Addresses button', 'datis'); ?> </a> </div> </div> <?php endif; ?> </div> <?php return; endif; /** * حالت فرم: billing یا shipping * فرم رو از partial خودت لود میکنیم. */ $load_address = in_array($load_address, array('billing', 'shipping'), true) ? $load_address : 'billing'; // این متغیرها رو به partial پاس میدیم $datis_address_context = array( 'customer_id' => $customer_id, 'load_address' => $load_address, ); do_action('woocommerce_before_edit_account_address_form'); // اگر این فایل در تم وجود داشت از همون بخون، وگرنه fallback به همین template $template = locate_template('woocommerce/myaccount/address-form.php'); if (! empty($template)) { // expose vars for included template $customer_id = $datis_address_context['customer_id']; $load_address = $datis_address_context['load_address']; include $template; } else { echo '<p>' . esc_html_x('Address form template not found.', 'Addresses error', 'datis') . '</p>'; } do_action('woocommerce_after_edit_account_address_form');
💾 保存文件
← 返回文件管理器