user filters

// افزودن ستون‌های “سطح کاربر”، “میزان قدمت” و “چند وقته خرید جدید نداشته” به لیست کاربران function add_custom_user_columns($columns) { $columns[‘user_level’] = ‘سطح کاربر’; $columns[‘user_age’] = ‘میزان قدمت’; $columns[‘last_purchase’] = ‘چند وقته خرید جدید نداشته’; return $columns; } add_filter(‘manage_users_columns’, ‘add_custom_user_columns’); //…Continue reading

all important 0

function custom_shop_order_column_content($column, $post_id) { if ($column == ‘customer_info’) { $order = wc_get_order($post_id); // دریافت شماره سفارش $order_number = $order->get_order_number(); // دریافت نام و نام خانوادگی خریدار $customer_name = $order->get_billing_first_name() . ‘ ‘ . $order->get_billing_last_name(); // دریافت شماره موبایل خریدار $customer_phone…Continue reading

all important 4

// هدایت نقش “sarparast-support” به لیست کاربران “customer” یا “poshtiban” function redirect_sarparast_support_to_customers_page() { if ( is_admin() && current_user_can(‘sarparast-support’) ) { global $pagenow; if ( ‘users.php’ == $pagenow ) { // اگر هیچ نقشی تعیین نشده است، کاربر را به صفحه…Continue reading

all important 6

// افزودن ستون “عناوین خریداری شده” add_filter(‘woocommerce_my_account_my_orders_columns’, ‘add_order_details_column_custom’); function add_order_details_column_custom($columns) { // اضافه کردن ستون بعد از ستون وضعیت $new_columns = []; foreach ($columns as $key => $name) { $new_columns[$key] = $name; if ($key === ‘order-status’) { $new_columns[‘order-details’] = ‘محصول’;…Continue reading

Wpallimport Time Stamp Converter

function convert_to_cst_for_import( $utc ) { if ( empty( $utc ) ) return ”; try { $dt = new DateTime( $utc, new DateTimeZone( ‘UTC’ ) ); $dt->setTimezone( new DateTimeZone( ‘America/Chicago’ ) ); // CST/CDT auto-handled return $dt->format( ‘Y-m-d H:i:s’ ); }…Continue reading

snip_FetchPriority version 10

add_action(‘template_redirect’, function () { ob_start(function ($html) { return preg_replace_callback( ‘#]+class=”[^”]*highfetchprio[^”]*”[^>]*)>#i’, function ($matches) { $img = $matches[0]; // ✅ Supprimer lazyload et attributs inutiles $img = preg_replace(‘#slazyload(ed)?#i’, ”, $img); $img = preg_replace(‘#sdata-lazy-[a-z]+=”[^”]*”#i’, ”, $img); // ✅ Supprimer anciens attributs $img =…Continue reading

snip_FetchPriority version 9

add_filter(‘wp_get_attachment_image_attributes’, function ($attr, $attachment) { if (!empty($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false) { // ✅ Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // ✅ Suppression complète des traces de lazyload $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”, $attr[‘class’]);…Continue reading

snip_FetchPriority version 8

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading

snip_FetchPriority version 7

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading