get_section( 'colors' )->panel = 'theme_colors_panel';
$wp_customize->get_section( 'colors' )->title = esc_html__('Color Options','primebulletin');
$wp_customize->get_section( 'title_tagline' )->panel = 'theme_general_settings';
$wp_customize->get_section( 'header_image' )->panel = 'theme_general_settings';
$wp_customize->get_section( 'background_image' )->panel = 'theme_general_settings';
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.header-titles .custom-logo-name',
'render_callback' => 'primebulletin_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'primebulletin_customize_partial_blogdescription',
) );
}
// Theme Options Panel.
$wp_customize->add_panel( 'theme_option_panel',
array(
'title' => esc_html__( 'Theme Options', 'primebulletin' ),
'priority' => 150,
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_panel( 'theme_general_settings',
array(
'title' => esc_html__( 'General Settings', 'primebulletin' ),
'priority' => 10,
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_panel( 'theme_colors_panel',
array(
'title' => esc_html__( 'Color Settings', 'primebulletin' ),
'priority' => 15,
'capability' => 'edit_theme_options',
)
);
// Template Options
$wp_customize->add_panel( 'theme_template_pannel',
array(
'title' => esc_html__( 'Template Settings', 'primebulletin' ),
'priority' => 150,
'capability' => 'edit_theme_options',
)
);
$primebulletin_default = primebulletin_get_default_theme_options();
$wp_customize->add_setting( 'header_bg_color',
array(
'default' => $primebulletin_default['header_bg_color'],
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'header_bg_color',
array(
'label' => esc_html__( 'Header Background Color', 'primebulletin' ),
'section' => 'colors',
'settings' => 'header_bg_color',
) )
);
// Register custom section types.
$wp_customize->register_section_type( 'PrimeBulletin_Customize_Section_Upsell' );
// Register sections.
$wp_customize->add_section(
new PrimeBulletin_Customize_Section_Upsell(
$wp_customize,
'theme_upsell',
array(
'title' => esc_html__( 'PrimeBulletin Pro', 'primebulletin' ),
'pro_text' => esc_html__( 'Upgrade To Pro', 'primebulletin' ),
'pro_url' => esc_url('https://www.themeinwp.com/theme/primebulletin-pro/'),
'priority' => 1,
)
)
);
}
endif;
add_action( 'customize_register', 'primebulletin_customize_register' );
/**
* Customizer Enqueue scripts and styles.
*/
if (!function_exists('primebulletin_customizer_scripts')) :
function primebulletin_customizer_scripts(){
wp_enqueue_script('jquery-ui-button');
wp_enqueue_style('primebulletin-customizer', get_template_directory_uri() . '/assets/lib/custom/css/customizer.css');
wp_enqueue_script('primebulletin-customizer', get_template_directory_uri() . '/assets/lib/custom/js/customizer.js', array('jquery','customize-controls'), '', 1);
$ajax_nonce = wp_create_nonce('primebulletin_customizer_ajax_nonce');
wp_localize_script(
'primebulletin-customizer',
'primebulletin_customizer',
array(
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
'ajax_nonce' => $ajax_nonce,
)
);
}
endif;
add_action('customize_controls_enqueue_scripts', 'primebulletin_customizer_scripts');
add_action('customize_controls_init', 'primebulletin_customizer_scripts');
/**
* Customizer Enqueue scripts and styles.
*/
function primebulletin_customizer_repearer(){
wp_enqueue_style('primebulletin-repeater', get_template_directory_uri() . '/assets/lib/custom/css/repeater.css');
wp_enqueue_script('primebulletin-repeater', get_template_directory_uri() . '/assets/lib/custom/js/repeater.js', array('jquery','customize-controls'), '', 1);
$primebulletin_post_category_list = primebulletin_post_category_list();
$cat_option = '';
if( $primebulletin_post_category_list ){
foreach( $primebulletin_post_category_list as $key => $cats ){
$cat_option .= "";
}
}
wp_localize_script(
'primebulletin-repeater',
'primebulletin_repeater',
array(
'optionns' => "
$cat_option,
'new_section' => esc_html__('New Section','primebulletin'),
'upload_image' => esc_html__('Choose Image','primebulletin'),
'use_image' => esc_html__('Select','primebulletin'),
)
);
wp_localize_script(
'primebulletin-customizer',
'primebulletin_customizer',
array(
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
)
);
}
add_action('customize_controls_enqueue_scripts', 'primebulletin_customizer_repearer');
/**
* Render the site title for the selective refresh partial.
*
* @return void
*/
if (!function_exists('primebulletin_customize_partial_blogname')) :
function primebulletin_customize_partial_blogname() {
bloginfo( 'name' );
}
endif;
/**
* Render the site tagline for the selective refresh partial.
*
* @return void
*/
if (!function_exists('primebulletin_customize_partial_blogdescription')) :
function primebulletin_customize_partial_blogdescription() {
bloginfo( 'description' );
}
endif;
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function primebulletin_customize_preview_js() {
wp_enqueue_script( 'primebulletin-customizer-preview', get_template_directory_uri() . '/assets/lib/custom/js/customizer-preview.js', array( 'customize-preview' ), '20151215', true );
}
add_action( 'customize_preview_init', 'primebulletin_customize_preview_js' );