term_id] = $cat->name; } $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->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 'link_color' setting */ $wp_customize->add_setting( "{$prefix}_theme_settings[link_color]", array( 'default' => $defaults['link_color'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_hex_color', ) ); /* Add the color control for the 'link_color' setting */ $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => esc_html__( 'Link Color', 'cakifo' ), 'section' => 'colors', 'settings' => "{$prefix}_theme_settings[link_color]", ) ) ); /* Add the 'featured_show' setting */ $wp_customize->add_setting( "{$prefix}_theme_settings[featured_show]", array( 'default' => false, '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' => '', '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', ) ); /* Add the 'twitter_username' setting */ $wp_customize->add_setting( "{$prefix}_theme_settings[twitter_username]", array( 'default' => '', 'type' => 'option', 'capability' => 'edit_theme_options', ) ); /* Add the text control for the 'twitter_username' setting */ $wp_customize->add_control( 'twitter_username', array( 'settings' => "{$prefix}_theme_settings[twitter_username]", 'label' => esc_html__( 'Optional: Twitter username', 'cakifo' ), 'section' => 'cakifo_customize_settings', 'type' => 'text', ) ); /* Add the 'headlines_category' setting */ $wp_customize->add_setting( "{$prefix}_theme_settings[headlines_category]", array( 'default' => array(), '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( $wp_customize, 'headlines_category', array( 'settings' => "{$prefix}_theme_settings[headlines_category]", 'label' => esc_html__( 'Headline Categories', 'cakifo' ), 'section' => 'static_front_page', 'type' => 'multiple-select', 'choices' => $categories ) ) ); /* 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' => 'static_front_page', '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() { ?>