Last active
September 29, 2017 02:59
-
-
Save bkaminski/0ab7364b976602c826079984d90f297b to your computer and use it in GitHub Desktop.
Bootstrap Carousel WP Theme Customizer Function Full Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ADD IMAGE, TEXT, and URL (Heading, Subtext, Link) TO FIRST IMAGE IN SEQUENCE -- WP THEME CUSTOMIZER | |
function theme_slug_home_img_slide_1( $wp_customize ) { | |
$wp_customize->add_section( | |
'home_slide_img_one', | |
array( | |
'title' => 'Home Image Slide 1', | |
'description' => 'This section updates all information pertaining to the first image in the slideshow on the home page', | |
'priority' => 1, | |
)); | |
$wp_customize->add_setting( 'theme_slug_slide_img_upload_one' ); | |
$wp_customize->add_control( new WP_Customize_Image_Control( | |
$wp_customize, | |
'theme_slug_slide_img_upload_one', array( | |
'label' => __( 'Upload image for first slider in sequence:', 'theme_slug' ), | |
'section' => 'home_slide_img_one', | |
'settings' => 'theme_slug_slide_img_upload_one', | |
'description' => 'Upload your first slider image here.' | |
))); | |
$wp_customize->add_setting( 'theme_slug_slide_title_1', array( | |
'default' => 'No Title Text Has Been Entered', | |
'sanitize_callback' => 'sanitize_headline_one_text', | |
)); | |
function sanitize_headline_one_text( $input ) { | |
return wp_kses_post( force_balance_tags( $input ) ); | |
} | |
$wp_customize->add_control( 'theme_slug_slide_title_1', array( | |
'type' => 'text', | |
'label' => __( 'Headline Text Here:', 'theme_slug' ), | |
'section' => 'home_slide_img_one' | |
)); | |
$wp_customize->add_setting( 'theme_slug_slide_text_1', array( | |
'default' => 'No Descriptive Text Has Been Entered', | |
'sanitize_callback' => 'sanitize_slide_one_descriptive_text' | |
)); | |
function sanitize_slide_one_descriptive_text( $input ) { | |
return wp_kses_post( force_balance_tags( $input ) ); | |
} | |
$wp_customize->add_control( 'theme_slug_slide_text_1', array( | |
'label' => __( 'Descriptive Text Here:', 'theme_slug' ), | |
'section' => 'home_slide_img_one', | |
'settings' => 'theme_slug_slide_text_1', | |
'type' => 'text' | |
)); | |
$wp_customize->add_setting( 'theme_slug_slide_one_link', array( | |
'default' => 'No Link URL Has Been Entered', | |
'sanitize_callback' => 'sanitize_link_one_url', | |
)); | |
function sanitize_link_one_url( $input ) { | |
return wp_kses_post( force_balance_tags( $input ) ); | |
} | |
$wp_customize->add_control( 'theme_slug_slide_one_link', array( | |
'label' => __( 'Slide 1 URL Here:', 'theme_slug' ), | |
'section' => 'home_slide_img_one', | |
'settings' => 'theme_slug_slide_one_link', | |
'type' => 'text', | |
)); | |
} //Ends section | |
add_action( 'customize_register', 'theme_slug_home_img_slide_1' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment