60,
'width' => 200,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script',
) );
add_theme_support( 'align-wide' );
add_theme_support( 'responsive-embeds' );
register_nav_menus( array(
'primary' => esc_html__( 'منوی اصلی', 'motayeb' ),
'footer' => esc_html__( 'منوی فوتر', 'motayeb' ),
) );
add_image_size( 'motayeb-product-grid', 400, 400, true );
add_image_size( 'motayeb-product-single', 600, 600, true );
}
add_action( 'after_setup_theme', 'motayeb_theme_setup' );
// ============================================================
// ۲. بارگذاری فایلهای استایل و اسکریپت (Enqueue) — اصلاحشده
// ============================================================
/**
* تابع کمکی: enqueue امن برای استایل — فقط اگه فایل وجود داشته باشه.
* از filemtime برای cache-busting استفاده میکنه تا با هر تغییر، کش مرورگر بشکنه.
*/
function motayeb_enqueue_style_safe( $handle, $rel_path, $deps = array(), $media = 'all' ) {
$path = get_theme_file_path( $rel_path );
if ( ! $path || ! file_exists( $path ) || 0 === filesize( $path ) ) {
return false;
}
wp_enqueue_style(
$handle,
get_theme_file_uri( $rel_path ),
$deps,
filemtime( $path ),
$media
);
return true;
}
/**
* تابع کمکی: enqueue امن برای اسکریپت — فقط اگه فایل وجود داشته باشه.
* jQuery بهصورت پیشفرض بارگذاری نمیشه؛ اگه واقعاً لازم بود، deps بده.
*/
function motayeb_enqueue_script_safe( $handle, $rel_path, $deps = array(), $in_footer = true ) {
$path = get_theme_file_path( $rel_path );
if ( ! $path || ! file_exists( $path ) || 0 === filesize( $path ) ) {
return false;
}
wp_enqueue_script(
$handle,
get_theme_file_uri( $rel_path ),
$deps,
filemtime( $path ),
$in_footer
);
return true;
}
function motayeb_scripts() {
$ver = MOTAYEB_VERSION;
// ۱. استایل اصلی تم (style.css در ریشه)
wp_enqueue_style( 'motayeb-style', get_stylesheet_uri(), array(), $ver );
// ۲. استایل Tailwind ساختهشده (پس از build استاتیک جایگزین Play CDN میشه)
motayeb_enqueue_style_safe( 'motayeb-tailwind', '/assets/css/tailwind.css', array( 'motayeb-style' ) );
// ۳. استایل ووکامرس — فقط اگه فایل واقعاً وجود داشت و خالی نبود
if ( class_exists( 'WooCommerce' ) ) {
motayeb_enqueue_style_safe( 'motayeb-woocommerce', '/assets/css/woocommerce.css', array( 'motayeb-style' ) );
}
// ۴. استایل ریسپانسیو
motayeb_enqueue_style_safe( 'motayeb-responsive', '/assets/css/responsive.css', array( 'motayeb-style' ) );
// ۵. اسکریپت اصلی (بدون jQuery — فرض بر اینه که با vanilla JS نوشته شده)
$main_loaded = motayeb_enqueue_script_safe( 'motayeb-main', '/assets/js/main.js' );
// ۶. پاس دادن متغیرها به JS — با guard ووکامرس
if ( $main_loaded ) {
$localize_data = array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( MOTAYEB_NONCE_ACTION ),
'home_url' => home_url( '/' ),
);
if ( class_exists( 'WooCommerce' ) ) {
$localize_data['checkout_url'] = wc_get_checkout_url();
$localize_data['cart_url'] = wc_get_cart_url();
}
wp_localize_script( 'motayeb-main', 'motayeb_ajax', $localize_data );
}
// ۷. اسکریپت ووکامرس — فقط روی صفحات فروشگاهی و اگه فایل پر بود
if ( class_exists( 'WooCommerce' ) ) {
if ( is_woocommerce() || is_cart() || is_checkout() || is_account_page() ) {
motayeb_enqueue_script_safe( 'motayeb-woocommerce', '/assets/js/woocommerce.js', array( 'motayeb-main' ) );
}
}
// ۸. اسکریپت دارکمود
motayeb_enqueue_script_safe( 'motayeb-darkmode', '/assets/js/darkmode.js' );
// ۹. اسکریپتهای پیشفرض ووکامرس روی صفحات مربوطه
if ( class_exists( 'WooCommerce' ) ) {
if ( is_product() ) { wp_enqueue_script( 'wc-single-product' ); }
if ( is_cart() ) { wp_enqueue_script( 'wc-cart' ); }
if ( is_checkout() ) { wp_enqueue_script( 'wc-checkout' ); }
}
}
add_action( 'wp_enqueue_scripts', 'motayeb_scripts' );
/**
* افزودن `defer` به اسکریپتهای خودمان برای بهبود بارگذاری.
* این کار parsing HTML رو مسدود نمیکنه.
*/
function motayeb_script_loader_tag( $tag, $handle ) {
$defer_handles = array( 'motayeb-main', 'motayeb-darkmode', 'motayeb-woocommerce' );
if ( in_array( $handle, $defer_handles, true ) ) {
return str_replace( ' src', ' defer src', $tag );
}
return $tag;
}
add_filter( 'script_loader_tag', 'motayeb_script_loader_tag', 10, 2 );
// ============================================================
// ۳. ثبت ناحیههای ویجت (Widget Areas)
// ============================================================
function motayeb_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'سایدبار اصلی', 'motayeb' ),
'id' => 'sidebar-main',
'before_widget' => '',
'before_title' => '
',
) );
if ( class_exists( 'WooCommerce' ) ) {
register_sidebar( array(
'name' => esc_html__( 'سایدبار فروشگاه', 'motayeb' ),
'id' => 'sidebar-shop',
'before_widget' => '',
'before_title' => '',
) );
}
for ( $i = 1; $i <= 4; $i++ ) {
register_sidebar( array(
'name' => esc_html__( 'فوتر - ستون ' . $i, 'motayeb' ),
'id' => 'footer-' . $i,
'before_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'motayeb_widgets_init' );
// ============================================================
// ۴. توابع کمکی ووکامرس
// ============================================================
add_filter( 'loop_shop_columns', function() { return 4; } );
add_filter( 'loop_shop_per_page', function() { return 12; } );
function motayeb_body_classes( $classes ) {
if ( class_exists( 'WooCommerce' ) ) {
if ( is_product() ) { $classes[] = 'motayeb-product-page'; }
if ( is_shop() ) { $classes[] = 'motayeb-shop-page'; }
}
// کوکی با sanitize_key بررسی میشه تا فقط 'on' یا '' قبول بشه
if ( isset( $_COOKIE['motayeb_darkmode'] ) && 'on' === sanitize_key( wp_unslash( $_COOKIE['motayeb_darkmode'] ) ) ) {
$classes[] = 'dark-mode';
}
return $classes;
}
add_filter( 'body_class', 'motayeb_body_classes' );
// ============================================================
// ۵. کلاسهای Walker برای منو
// ============================================================
class Motayeb_Desktop_Walker extends Walker_Nav_Menu {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$output .= '';
}
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$classes = 'relative group';
if ( $depth === 0 ) {
$classes .= ' nav-link text-sm font-medium text-earth-400 dark:text-dark-text hover:text-forest-500 dark:hover:text-forest-300 transition';
}
$output .= '- ';
$output .= '' . esc_html( $item->title ) . '';
}
public function end_el( &$output, $item, $depth = 0, $args = array() ) {
$output .= '
';
}
}
class Motayeb_Mobile_Walker extends Walker_Nav_Menu {
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$output .= '';
$output .= '';
$output .= '' . esc_html( $item->title ) . '';
$output .= '';
}
public function end_el( &$output, $item, $depth = 0, $args = array() ) {}
}
// ============================================================
// ۶. توابع Ajax برای جستجو و دریافت محصولات — اصلاحشده
// ============================================================
/**
* دریافت اطلاعات یک محصول با ID.
* فقط روی محصولات منتشرشده کار میکنه.
*/
function motayeb_ajax_get_product_data() {
check_ajax_referer( MOTAYEB_NONCE_ACTION, 'nonce' );
if ( ! class_exists( 'WooCommerce' ) ) {
wp_send_json_error( 'ووکامرس فعال نیست' );
}
$product_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
if ( ! $product_id ) {
wp_send_json_error( 'شناسه محصول نامعتبر است' );
}
$product = wc_get_product( $product_id );
if ( ! $product || 'publish' !== $product->get_status() ) {
wp_send_json_error( 'محصول یافت نشد' );
}
$image = wp_get_attachment_image_src( $product->get_image_id(), 'thumbnail' );
wp_send_json_success( array(
'id' => $product->get_id(),
'name' => $product->get_name(),
'price' => $product->get_price() !== '' ? floatval( $product->get_price() ) : 0,
'img' => $image ? $image[0] : '',
'stock' => $product->get_stock_quantity(),
'permalink' => $product->get_permalink(),
) );
}
add_action( 'wp_ajax_get_product_data', 'motayeb_ajax_get_product_data' );
add_action( 'wp_ajax_nopriv_get_product_data', 'motayeb_ajax_get_product_data' );
/**
* جستجوی زنده محصولات — از wc_get_products استفاده میکنه تا
* visibility ووکامرسی (محصولات hidden از کاتالوگ) رعایت بشه.
*/
function motayeb_ajax_search_products() {
check_ajax_referer( MOTAYEB_NONCE_ACTION, 'nonce' );
if ( ! class_exists( 'WooCommerce' ) ) {
wp_send_json_error( 'ووکامرس فعال نیست' );
}
$term = isset( $_GET['term'] ) ? sanitize_text_field( wp_unslash( $_GET['term'] ) ) : '';
if ( strlen( $term ) < 2 ) {
wp_send_json_success( array() );
}
$products = wc_get_products( array(
'status' => 'publish',
'limit' => 6,
'paginate' => false,
's' => $term,
) );
$results = array();
foreach ( $products as $product ) {
$image = wp_get_attachment_image_src( $product->get_image_id(), 'thumbnail' );
$terms = wp_get_post_terms( $product->get_id(), 'product_cat', array( 'fields' => 'names' ) );
$results[] = array(
'id' => $product->get_id(),
'name' => $product->get_name(),
'price' => $product->get_price() !== '' ? floatval( $product->get_price() ) : 0,
'image' => $image ? $image[0] : '',
'category' => ! empty( $terms ) ? $terms[0] : '',
'permalink' => $product->get_permalink(),
);
}
wp_send_json_success( $results );
}
add_action( 'wp_ajax_search_products', 'motayeb_ajax_search_products' );
add_action( 'wp_ajax_nopriv_search_products', 'motayeb_ajax_search_products' );
// ============================================================
// ۷. متاباکسهای سفارشی برای محصولات
// ============================================================
function motayeb_add_product_metaboxes() {
add_meta_box( 'motayeb_ingredients', 'ترکیبات محصول', 'motayeb_ingredients_metabox_callback', 'product', 'normal', 'high' );
add_meta_box( 'motayeb_health_benefits', 'خواص سلامت (هر آیتم در یک خط + آیکون انتخابی)', 'motayeb_health_benefits_metabox_callback', 'product', 'normal', 'high' );
}
add_action( 'add_meta_boxes', 'motayeb_add_product_metaboxes' );
function motayeb_ingredients_metabox_callback( $post ) {
wp_nonce_field( 'motayeb_save_ingredients', 'motayeb_ingredients_nonce' );
$value = get_post_meta( $post->ID, '_ingredients', true );
echo '';
wp_editor( $value, 'ingredients_field', array(
'textarea_name' => 'ingredients_field', 'textarea_rows' => 8, 'media_buttons' => false, 'teeny' => true, 'quicktags' => true
) );
}
function motayeb_health_benefits_metabox_callback( $post ) {
wp_nonce_field( 'motayeb_save_health_benefits', 'motayeb_health_benefits_nonce' );
$benefits = get_post_meta( $post->ID, '_health_benefits', true );
if ( ! is_array( $benefits ) ) { $benefits = array(); }
$benefits_title = get_post_meta( $post->ID, '_health_benefits_title', true );
$icon_list = array( 'heart-pulse' => '❤️ تپش قلب', 'flame' => '🔥 شعله', 'stomach' => '🫀 معده', 'sparkles' => '✨ جرقه', 'shield-check' => '🛡️ سپر', 'droplets' => '💧 قطره', 'leaf' => '🍃 برگ', 'sun' => '☀️ خورشید', 'zap' => '⚡ برق', 'moon' => '🌙 ماه', 'star' => '⭐ ستاره', 'smile' => '😊 لبخند' );
$color_list = array( 'text-red-400' => 'قرمز', 'text-orange-400' => 'نارنجی', 'text-green-400' => 'سبز', 'text-purple-400' => 'بنفش', 'text-blue-400' => 'آبی', 'text-amber-400' => 'عنبری', 'text-emerald-400' => 'زمردی', 'text-rose-400' => 'گلبهی', 'text-pink-400' => 'صورتی', 'text-indigo-400' => 'نیلی' );
?>
هر آیتم شامل عنوان، توضیحات، آیکون و رنگ است. برای افزودن آیتم جدید، دکمه زیر را بزنید.
$title ) {
if ( ! empty( $title ) && isset( $descs[ $index ] ) ) {
$benefits[] = array(
'title' => $title,
'description' => $descs[ $index ],
'icon' => isset( $icons[ $index ] ) ? $icons[ $index ] : 'heart-pulse',
'color' => isset( $colors[ $index ] ) ? $colors[ $index ] : 'text-red-400',
);
}
}
update_post_meta( $post_id, '_health_benefits', $benefits );
}
}
add_action( 'save_post_product', 'motayeb_save_product_metaboxes' );
// ============================================================
// ۸. ذخیره امتیاز دیدگاهها — با اعتبارسنجی محدوده ۱ تا ۵
// ============================================================
function motayeb_save_rating_field( $comment_id ) {
if ( isset( $_POST['rating'] ) ) {
$rating = intval( $_POST['rating'] );
if ( $rating >= 1 && $rating <= 5 ) {
update_comment_meta( $comment_id, 'rating', $rating );
}
}
}
add_action( 'comment_post', 'motayeb_save_rating_field' );
// ============================================================
// ۹. تنظیمات تم مطیب (با استفاده از Settings API)
// ============================================================
function motayeb_add_admin_menu() {
add_options_page(
'تنظیمات تم مطیب',
'تنظیمات مطیب',
'manage_options',
'motayeb_settings',
'motayeb_settings_page_callback'
);
}
add_action( 'admin_menu', 'motayeb_add_admin_menu' );
function motayeb_admin_scripts( $hook ) {
if ( 'settings_page_motayeb_settings' !== $hook ) {
return;
}
wp_enqueue_media();
wp_enqueue_script( 'jquery' );
}
add_action( 'admin_enqueue_scripts', 'motayeb_admin_scripts' );
function motayeb_register_settings() {
add_settings_section(
'motayeb_shop_section',
'تنظیمات صفحه فروشگاه',
'motayeb_shop_section_callback',
'motayeb_settings'
);
add_settings_field(
'motayeb_shop_banner',
'عکس بنر فروشگاه',
'motayeb_shop_banner_callback',
'motayeb_settings',
'motayeb_shop_section'
);
register_setting( 'motayeb_settings', 'motayeb_shop_banner', 'esc_url_raw' );
for ( $i = 1; $i <= 4; $i++ ) {
add_settings_field(
'motayeb_feature_' . $i . '_icon',
'آیکون ویژگی ' . $i . ' (مثلاً: lucide:leaf)',
'motayeb_text_field_callback',
'motayeb_settings',
'motayeb_shop_section',
array( 'id' => 'motayeb_feature_' . $i . '_icon', 'default' => 'lucide:leaf' )
);
register_setting( 'motayeb_settings', 'motayeb_feature_' . $i . '_icon', 'sanitize_text_field' );
add_settings_field(
'motayeb_feature_' . $i . '_text',
'متن ویژگی ' . $i,
'motayeb_text_field_callback',
'motayeb_settings',
'motayeb_shop_section',
array( 'id' => 'motayeb_feature_' . $i . '_text', 'default' => 'ویژگی ' . $i )
);
register_setting( 'motayeb_settings', 'motayeb_feature_' . $i . '_text', 'sanitize_text_field' );
}
}
add_action( 'admin_init', 'motayeb_register_settings' );
function motayeb_shop_section_callback() {
echo 'تنظیمات بنر و ویژگیهای نمایش داده شده در صفحه فروشگاه را در اینجا مدیریت کنید.
';
}
function motayeb_shop_banner_callback() {
$value = get_option( 'motayeb_shop_banner', '' );
?>
';
}
function motayeb_settings_page_callback() {
?>
تنظیمات تم مطیب
بدون امتیاز';
}
$rating = floatval( $rating );
$full_stars = floor( $rating );
$half_star = ( $rating - $full_stars ) >= 0.5 ? 1 : 0;
$empty_stars = 5 - $full_stars - $half_star;
$html = '';
for ( $i = 0; $i < $full_stars; $i++ ) {
$html .= '★';
}
if ( $half_star ) {
$html .= '★★';
}
for ( $i = 0; $i < $empty_stars; $i++ ) {
$html .= '★';
}
if ( $count > 0 ) {
$html .= ' (' . esc_html( number_format_i18n( $count ) ) . ')';
}
$html .= '';
return $html;
}
// ============================================================
// ۱۲. پاکسازی transient cache هنگام ذخیره محصول/دستهبندی
// ============================================================
function motayeb_clear_home_transients( $post_id ) {
if ( 'product' === get_post_type( $post_id ) ) {
delete_transient( 'motayeb_home_bestsellers' );
// پاک کردن کش شمارش دستهبندیها
$terms = wp_get_post_terms( $post_id, 'product_cat', array( 'fields' => 'ids' ) );
if ( ! is_wp_error( $terms ) ) {
foreach ( $terms as $term_id ) {
delete_transient( 'motayeb_cat_count_' . $term_id );
}
}
}
}
add_action( 'save_post_product', 'motayeb_clear_home_transients' );
add_action( 'woocommerce_product_set_stock_status', 'motayeb_clear_home_transients' );
// پاکسازی هنگام ویرایش دستهبندی
function motayeb_clear_category_transients( $term_id, $taxonomy = '' ) {
if ( 'product_cat' === $taxonomy || empty( $taxonomy ) ) {
delete_transient( 'motayeb_home_categories' );
delete_transient( 'motayeb_cat_count_' . $term_id );
}
}
add_action( 'edited_product_cat', 'motayeb_clear_category_transients', 10, 2 );
add_action( 'created_product_cat', 'motayeb_clear_category_transients', 10, 2 );
add_action( 'delete_product_cat', 'motayeb_clear_category_transients', 10, 2 );
// اضافه کردن فیلد آیکون به صفحه افزودن/ویرایش دستهبندی محصول
function motayeb_add_category_icon_field( $term = null ) {
$icon = $term ? get_term_meta( $term->term_id, 'motayeb_icon', true ) : '';
$color = $term ? get_term_meta( $term->term_id, 'motayeb_color', true ) : '';
?>
'شماره تماس',
'motayeb_contact_email' => 'ایمیل',
'motayeb_contact_address' => 'آدرس',
);
foreach ( $contact_fields as $id => $label ) {
add_settings_field(
$id,
$label,
'motayeb_text_field_callback',
'motayeb_settings',
'motayeb_contact_section',
array( 'id' => $id, 'default' => '' )
);
register_setting( 'motayeb_settings', $id, 'sanitize_text_field' );
}
// بخش شبکههای اجتماعی
add_settings_section(
'motayeb_social_section',
'شبکههای اجتماعی',
'motayeb_social_section_callback',
'motayeb_settings'
);
$social_fields = array(
'motayeb_social_instagram' => 'لینک اینستاگرام',
'motayeb_social_telegram' => 'لینک تلگرام',
'motayeb_social_twitter' => 'لینک توییتر',
);
foreach ( $social_fields as $id => $label ) {
add_settings_field(
$id,
$label,
'motayeb_text_field_callback',
'motayeb_settings',
'motayeb_social_section',
array( 'id' => $id, 'default' => '' )
);
register_setting( 'motayeb_settings', $id, 'esc_url_raw' );
}
// بخش نمادهای اعتماد
add_settings_section(
'motayeb_badges_section',
'نمادهای اعتماد',
'motayeb_badges_section_callback',
'motayeb_settings'
);
$badge_fields = array(
'motayeb_enamad_url' => 'لینک نماد اعتماد الکترونیکی',
'motayeb_samandehi_url'=> 'لینک ساماندهی',
);
foreach ( $badge_fields as $id => $label ) {
add_settings_field(
$id,
$label,
'motayeb_text_field_callback',
'motayeb_settings',
'motayeb_badges_section',
array( 'id' => $id, 'default' => '' )
);
register_setting( 'motayeb_settings', $id, 'esc_url_raw' );
}
// بخش انتخاب صفحات خدمات مشتریان
add_settings_section(
'motayeb_pages_section',
'صفحات خدمات مشتریان',
'motayeb_pages_section_callback',
'motayeb_settings'
);
$page_fields = array(
'motayeb_page_faq' => 'صفحه سوالات متداول',
'motayeb_page_return' => 'صفحه شرایط بازگشت',
'motayeb_page_shipping' => 'صفحه نحوه ارسال',
'motayeb_page_privacy' => 'صفحه حریم خصوصی',
'motayeb_page_terms' => 'صفحه قوانین و مقررات',
'motayeb_page_about' => 'صفحه درباره ما',
'motayeb_page_contact' => 'صفحه تماس با ما',
);
foreach ( $page_fields as $id => $label ) {
add_settings_field(
$id,
$label,
'motayeb_page_select_callback',
'motayeb_settings',
'motayeb_pages_section',
array( 'id' => $id )
);
register_setting( 'motayeb_settings', $id, 'intval' );
}
}
add_action( 'admin_init', 'motayeb_register_contact_settings' );
function motayeb_contact_section_callback() {
echo 'اطلاعاتی که در فوتر سایت نمایش داده میشود را وارد کنید.
';
}
function motayeb_social_section_callback() {
echo 'لینک شبکههای اجتماعی فروشگاه خود را وارد کنید. برای مخفی کردن یک شبکه، فیلد آن را خالی بگذارید.
';
}
function motayeb_badges_section_callback() {
echo 'لینک صفحه نماد اعتماد و ساماندهی خود را وارد کنید. اگه خالی باشند، نمایش داده نمیشوند.
';
}
function motayeb_pages_section_callback() {
echo 'صفحات وردپرس که برای خدمات مشتریان استفاده میشوند را انتخاب کنید.
';
}
// Callback برای انتخاب صفحه
function motayeb_page_select_callback( $args ) {
$id = $args['id'];
$current = get_option( $id, 0 );
wp_dropdown_pages( array(
'name' => $id,
'id' => $id,
'selected' => $current,
'show_option_none' => '— انتخاب کنید —',
'option_none_value'=> 0,
) );
}
// ============================================================
// ۱۳. شمارش محصولات در دسته شامل زیردستهها (با cache)
// ============================================================
function motayeb_count_category_products( $term_id ) {
$transient_key = 'motayeb_cat_count_' . $term_id;
$count = get_transient( $transient_key );
if ( false === $count ) {
$terms = get_terms( array(
'taxonomy' => 'product_cat',
'child_of' => $term_id,
'hide_empty' => false,
'fields' => 'ids',
) );
$all_ids = array_merge( array( $term_id ), ( is_array( $terms ) ? $terms : array() ) );
$query = new WP_Query( array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'fields' => 'ids',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $all_ids,
),
),
) );
$count = $query->found_posts;
wp_reset_postdata();
set_transient( $transient_key, $count, DAY_IN_SECONDS );
}
return $count;
}
// عدد فارسی برای شمارش
function motayeb_fa_count( $n ) {
return number_format_i18n( intval( $n ) );
}