نظر شما در انتظار تایید مدیریت است.
'; } echo '__( 'منوی اصلی', 'motayeb' ),
'footer' => __( 'منوی فوتر', 'motayeb' ),
) );
}
add_action( 'after_setup_theme', 'motayeb_setup' );
// ۲. لود فایلهای CSS و JS
function motayeb_scripts() {
wp_enqueue_style( 'vazirmatn', 'https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap', array(), null );
wp_enqueue_script( 'tailwind-cdn', 'https://cdn.tailwindcss.com', array(), null, false );
wp_add_inline_script( 'tailwind-cdn', "
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
forest: { 50:'#e8f5ec', 100:'#c6e6cf', 200:'#9ed0ae', 300:'#6fb88a', 400:'#4a9a6b', 500:'#2D5F3F', 600:'#254d34', 700:'#1c3b28', 800:'#13291c', 900:'#0a1710' },
cream: { 50:'#FDFBF7', 100:'#F5F0E8', 200:'#EBE3D5', 300:'#DDD2BF', 400:'#C4B49A', 500:'#A99478' },
honey: { 50:'#FDF5ED', 100:'#F9E6D0', 200:'#F2CC9E', 300:'#E8AC6A', 400:'#D4A574', 500:'#C08B52', 600:'#A07040', 700:'#7D5630', 800:'#5A3D20', 900:'#3A2612' },
earth: { 50:'#F5EDE7', 100:'#E8D5C7', 200:'#D4B5A0', 300:'#BF9276', 400:'#8B5A3C', 500:'#734A30', 600:'#5C3B25', 700:'#452C1B', 800:'#2E1D12', 900:'#170E09' },
dark: { bg:'#1A1D23', card:'#22262E', border:'#2E333D', text:'#E8E6E3', muted:'#9CA3AF' }
},
fontFamily: { vazir: ['Vazirmatn', 'sans-serif'], inter: ['Inter', 'sans-serif'] }
}
}
}
" );
wp_enqueue_style( 'motayeb-main', get_template_directory_uri() . '/assets/css/main.css', array(), '1.0.0' );
wp_enqueue_script( 'iconify', 'https://code.iconify.design/iconify-icon/1.0.7/iconify-icon.min.js', array(), null, true );
wp_enqueue_script( 'motayeb-main', get_template_directory_uri() . '/assets/js/main.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'motayeb_scripts' );
// ۳. حذف استایل پیشفرض ووکامرس
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
// ۴. بازنویسی تگهای Wraper ووکامرس
function motayeb_woo_wrapper_start() {
echo ' نظر شما در انتظار تایید مدیریت است.
طبیعت' ),
array( 'key' => 'field_hero_subtitle', 'name' => 'hero_subtitle', 'label' => 'زیرعنوان', 'type' => 'textarea', 'rows' => 2, 'default_value' => 'از عسل کوهستان تا ارده سنتی، هر محصول مطیب سفری به دل طبیعت ایران است.' ),
array( 'key' => 'field_hero_image', 'name' => 'hero_image', 'label' => 'تصویر هیرو', 'type' => 'image', 'return_format' => 'array' ),
array( 'key' => 'field_hero_btn_text', 'name' => 'hero_btn_text', 'label' => 'متن دکمه', 'type' => 'text', 'default_value' => 'مشاهده محصولات' ),
array( 'key' => 'field_stats_tab', 'label' => 'آمار', 'type' => 'tab' ),
array( 'key' => 'field_stats', 'name' => 'stats', 'label' => 'آمار', 'type' => 'repeater', 'layout' => 'horizontal', 'button_label' => 'افزودن', 'sub_fields' => array(
array( 'key' => 'field_stat_number', 'name' => 'number', 'label' => 'عدد', 'type' => 'text' ),
array( 'key' => 'field_stat_label', 'name' => 'label', 'label' => 'توضیح', 'type' => 'text' ),
)),
array( 'key' => 'field_cats_tab', 'label' => 'دستهبندیها', 'type' => 'tab' ),
array( 'key' => 'field_categories', 'name' => 'home_categories', 'label' => 'دستهبندیها', 'type' => 'repeater', 'layout' => 'table', 'button_label' => 'افزودن', 'sub_fields' => array(
array( 'key' => 'field_cat_title', 'name' => 'title', 'label' => 'نام', 'type' => 'text' ),
array( 'key' => 'field_cat_icon', 'name' => 'icon', 'label' => 'آیکون', 'type' => 'text' ),
array( 'key' => 'field_cat_color', 'name' => 'color', 'label' => 'رنگ', 'type' => 'select', 'choices' => array( 'honey' => 'عسلی', 'forest' => 'سبز', 'red' => 'قرمز', 'emerald' => 'سبز روشن', 'amber' => 'کهربایی' ) ),
array( 'key' => 'field_cat_link', 'name' => 'link', 'label' => 'لینک', 'type' => 'url' ),
array( 'key' => 'field_cat_count', 'name' => 'count', 'label' => 'تعداد', 'type' => 'text' ),
)),
array( 'key' => 'field_bestsellers_tab', 'label' => 'پرفروشها', 'type' => 'tab' ),
array( 'key' => 'field_bestsellers', 'name' => 'bestseller_ids', 'label' => 'محصولات پرفروش', 'type' => 'relationship', 'post_type' => array( 'product' ), 'filters' => array( 'search' ), 'elements' => array( 'featured_image' ), 'min' => 1, 'max' => 8, 'return_format' => 'id' ),
array( 'key' => 'field_story_tab', 'label' => 'داستان برند', 'type' => 'tab' ),
array( 'key' => 'field_story_title', 'name' => 'story_title', 'label' => 'عنوان', 'type' => 'text', 'default_value' => 'داستان مطیب، از طبیعت تا سفره شما' ),
array( 'key' => 'field_story_text', 'name' => 'story_text', 'label' => 'متن', 'type' => 'textarea', 'rows' => 4 ),
array( 'key' => 'field_story_image', 'name' => 'story_image', 'label' => 'تصویر', 'type' => 'image', 'return_format' => 'array' ),
array( 'key' => 'field_story_values', 'name' => 'story_values', 'label' => 'ویژگیها', 'type' => 'repeater', 'layout' => 'table', 'button_label' => 'افزودن', 'sub_fields' => array(
array( 'key' => 'field_val_icon', 'name' => 'icon', 'label' => 'آیکون', 'type' => 'text' ),
array( 'key' => 'field_val_title', 'name' => 'title', 'label' => 'عنوان', 'type' => 'text' ),
array( 'key' => 'field_val_desc', 'name' => 'desc', 'label' => 'توضیح', 'type' => 'text' ),
)),
array( 'key' => 'field_story_badges', 'name' => 'certificates', 'label' => 'گواهیها', 'type' => 'repeater', 'layout' => 'horizontal', 'button_label' => 'افزودن', 'sub_fields' => array(
array( 'key' => 'field_badge_text', 'name' => 'text', 'label' => 'متن', 'type' => 'text' ),
)),
array( 'key' => 'field_testimonials_tab', 'label' => 'نظرات', 'type' => 'tab' ),
array( 'key' => 'field_testimonials', 'name' => 'testimonials', 'label' => 'نظرات', 'type' => 'repeater', 'layout' => 'block', 'button_label' => 'افزودن', 'sub_fields' => array(
array( 'key' => 'field_test_text', 'name' => 'text', 'label' => 'متن', 'type' => 'textarea', 'rows' => 3 ),
array( 'key' => 'field_test_name', 'name' => 'name', 'label' => 'نام', 'type' => 'text' ),
array( 'key' => 'field_test_city', 'name' => 'city', 'label' => 'شهر', 'type' => 'text' ),
array( 'key' => 'field_test_init', 'name' => 'initials', 'label' => 'حروف', 'type' => 'text' ),
)),
array( 'key' => 'field_newsletter_tab', 'label' => 'خبرنامه', 'type' => 'tab' ),
array( 'key' => 'field_news_title', 'name' => 'newsletter_title', 'label' => 'عنوان', 'type' => 'text', 'default_value' => 'از تخفیفها باخبر شوید' ),
array( 'key' => 'field_news_text', 'name' => 'newsletter_text', 'label' => 'توضیح', 'type' => 'text', 'default_value' => 'با عضویت در خبرنامه، از جدیدترین محصولات مطلع شوید.' ),
),
'location' => array(
array( array( 'param' => 'page_template', 'operator' => '==', 'value' => 'front-page.php' ) ),
),
) );
}
// ===================================================================
// تابع کمکی برای ظاهر کامنتها (بدون خطای Cannot redeclare)
// ===================================================================
function motayeb_comment_callback($comment, $args, $depth) {
$author = get_comment_author($comment);
$initial = mb_substr($author, 0, 1);
$date = get_comment_date('Y/m/d');
$text = wpautop( esc_html( get_comment_text($comment) ) );
$is_pending = ('0' == $comment->comment_approved);
echo '
عسل طبیعی یکی از قدیمیترین مواد غذایی است.
', 'img' => 'https://images.unsplash.com/photo-1558642452-9d2a7deb7f62?w=800&q=80'), array('title' => 'طرز تهیه حلوا ارده خانگی', 'content' => 'حلوا ارده یکی از شیرینیهای سنتی ایرانی است.
', 'img' => 'https://images.unsplash.com/photo-1590080875515-8a3a8dc5735e?w=800&q=80') ); foreach ($posts_data as $post_data) { $attach_id = media_sideload_image($post_data['img'], 0, $post_data['title'], 'id'); if (is_wp_error($attach_id)) { $attach_id = ''; } $post_id = wp_insert_post(array( 'post_title' => $post_data['title'], 'post_content' => $post_data['content'], 'post_status' => 'publish', 'post_type' => 'post', )); if (!is_wp_error($post_id)) { wp_set_object_terms($post_id, array((int)$blog_cat_id), 'category'); if ($attach_id) { set_post_thumbnail($post_id, $attach_id); } } } update_option('motayeb_seeded_done', true); wp_redirect(admin_url('admin.php?seed_success=1')); exit; } add_action('admin_notices', 'motayeb_seed_success_notice'); function motayeb_seed_success_notice() { if (isset($_GET['seed_success'])) { echo 'موفقیتآمیز! دیتای تستی اضافه شد.