// Developer / Team CPT function yekadmin_register_developer_cpt() { $labels = array('name'=>'تیم','singular_name'=>'پروفایل','menu_name'=>'Team','add_new'=>'افزودن پروفایل'); $args = array('labels'=>$labels, 'public'=>true, 'has_archive'=>false, 'supports'=>array('title','editor','thumbnail','excerpt'), 'rewrite'=>array('slug'=>'team'), 'show_in_rest'=>true, 'menu_icon'=>'dashicons-admin-users'); register_post_type('developer',$args); } add_action('init','yekadmin_register_developer_cpt'); /* ------------------ Customizer: multilingual fields & colors ------------------ */ if ( ! function_exists('yekadmin_customize_register') ) { function yekadmin_customize_register($wp_customize) { // Languages: Hero title (FA/EN) $wp_customize->add_section('yekadmin_texts', array('title'=>__('متن‌ها / Texts','yekadmin'),'priority'=>30)); $wp_customize->add_setting('yekadmin_hero_title_fa', array('default'=>'سایت شما، قدرتمندترین ابزار بازاریابی','sanitize_callback'=>'sanitize_text_field')); $wp_customize->add_control('yekadmin_hero_title_fa', array('label'=>'Hero Title (فارسی)','section'=>'yekadmin_texts','type'=>'text')); $wp_customize->add_setting('yekadmin_hero_title_en', array('default'=>'Your website — the most powerful marketing tool','sanitize_callback'=>'sanitize_text_field')); $wp_customize->add_control('yekadmin_hero_title_en', array('label'=>'Hero Title (English)','section'=>'yekadmin_texts','type'=>'text')); // Colors $wp_customize->add_section('yekadmin_colors', array('title'=>__('رنگ‌ها / Colors','yekadmin'),'priority'=>31)); $wp_customize->add_setting('yekadmin_primary_color', array('default'=>'#667eea','sanitize_callback'=>'sanitize_hex_color')); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize,'yekadmin_primary_color', array('label'=>'Primary Color','section'=>'yekadmin_colors','settings'=>'yekadmin_primary_color'))); $wp_customize->add_setting('yekadmin_gradient_start', array('default'=>'#667eea','sanitize_callback'=>'sanitize_hex_color')); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize,'yekadmin_gradient_start', array('label'=>'Gradient Start','section'=>'yekadmin_colors','settings'=>'yekadmin_gradient_start'))); $wp_customize->add_setting('yekadmin_gradient_end', array('default'=>'#764ba2','sanitize_callback'=>'sanitize_hex_color')); $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize,'yekadmin_gradient_end', array('label'=>'Gradient End','section'=>'yekadmin_colors','settings'=>'yekadmin_gradient_end'))); } add_action('customize_register','yekadmin_customize_register'); } // Apply colors inline in head to override CSS variables if ( ! function_exists('yekadmin_custom_colors_inline') ) { function yekadmin_custom_colors_inline() { $start = get_theme_mod('yekadmin_gradient_start', '#667eea'); $end = get_theme_mod('yekadmin_gradient_end', '#764ba2'); $primary = get_theme_mod('yekadmin_primary_color', '#667eea'); // sanitize values $start = sanitize_hex_color($start) ?: '#667eea'; $end = sanitize_hex_color($end) ?: '#764ba2'; $primary = sanitize_hex_color($primary) ?: '#667eea'; // print inline CSS to override CSS variables echo \"\"; } add_action('wp_head','yekadmin_custom_colors_inline', 11); } /* ------------------ Include meta boxes for developer CPT ------------------ */ require_once get_template_directory() . '/inc/meta-boxes.php';