'' ); foreach ( get_categories() as $cat ) { $categories[$cat->term_id] = $cat->name; } $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /* Add the Cakifo section. */ $wp_customize->add_section( 'cakifo_customize_settings', array( 'title' => esc_html__( 'Cakifo settings', 'cakifo' ), 'priority' => 35, 'capability' => 'edit_theme_options' ) ); /* Add the 'headlines_category' setting. */ $wp_customize->add_setting( "{$prefix}_theme_settings[headlines_category]", array( 'default' => $defaults['headlines_category'], 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the multiple select control for the 'headlines_category' setting. */ $wp_customize->add_control( new Cakifo_Customize_Control_Multiple_Select_Headlines( $wp_customize, 'headlines_category', array( 'settings' => "{$prefix}_theme_settings[headlines_category]", 'label' => esc_html__( 'Headline Terms', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'cakifo-headlines-multiple-select' ) ) ); /* Add the 'headlines_num_posts' setting. */ $wp_customize->add_setting( "{$prefix}_theme_settings[headlines_num_posts]", array( 'default' => $defaults['headlines_num_posts'], 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the text control for the 'headlines_num_posts' setting. */ $wp_customize->add_control( 'headlines_num_posts', array( 'settings' => "{$prefix}_theme_settings[headlines_num_posts]", 'label' => esc_html__( 'Number of Headline posts', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'text', ) ); /* Add the 'featured_show' setting. */ $wp_customize->add_setting( "{$prefix}_theme_settings[featured_show]", array( 'default' => $defaults['featured_show'], 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the checkbox control for the 'featured_show' setting. */ $wp_customize->add_control( 'featured_show', array( 'settings' => "{$prefix}_theme_settings[featured_show]", 'label' => esc_html__( 'Show "Featured Content" slider?', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'checkbox', ) ); /* Add the 'featured_category' setting. */ $wp_customize->add_setting( "{$prefix}_theme_settings[featured_category]", array( 'default' => $defaults['featured_category'], 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the select control for the 'featured_category' setting. */ $wp_customize->add_control( 'featured_category', array( 'settings' => "{$prefix}_theme_settings[featured_category]", 'label' => esc_html__( 'Featured Category', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'select', 'choices' => $categories ) ); /* Add the 'featured_posts' setting. */ $wp_customize->add_setting( "{$prefix}_theme_settings[featured_posts]", array( 'default' => $defaults['featured_posts'], 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the text control for the 'featured_posts' setting. */ $wp_customize->add_control( 'featured_posts', array( 'settings' => "{$prefix}_theme_settings[featured_posts]", 'label' => esc_html__( 'Number of posts in the slider', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'text', ) ); if ( $wp_customize->is_preview() && ! is_admin() ) add_action( 'wp_footer', 'cakifo_customize_preview', 21 ); } /** * Bind JS handlers to make Theme Customizer preview reload changes asynchronously. * Used with blogname and blogdescription. * * @since Cakifo 1.4.0 */ function cakifo_customize_preview() { ?>