Skip to content

Instantly share code, notes, and snippets.

@bonjmartn
Created June 18, 2016 23:12
Show Gist options
  • Save bonjmartn/c57cecda7208402fc78d0ab458931a2f to your computer and use it in GitHub Desktop.
Save bonjmartn/c57cecda7208402fc78d0ab458931a2f to your computer and use it in GitHub Desktop.
WordPress Customizer Code for Slide 1
// Slide 1 Image
$wp_customize->add_section( 'slide_1' , array(
'title' => __('Slide 1','manly-recipes'),
'panel' => 'carousel_settings',
'priority' => 20
) );
$wp_customize->add_setting(
'slide_1_img',
array(
'default' => get_template_directory_uri() . '/images/blueberries.jpg',
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text'
)
);
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'slide_1',
array(
'label' => __( 'Choose Photo', 'manly-recipes' ),
'section' => 'slide_1',
'settings' => 'slide_1_img',
'context' => 'slide-1-img'
)
)
);
// Slide 1 Headline
$wp_customize->add_setting(
'slide_1_headline',
array(
'default' => __( 'Slide 1 Headline', 'manly-recipes' ),
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text'
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'manly_slide_1_headline',
array(
'label' => __( 'Headline', 'manly-recipes' ),
'section' => 'slide_1',
'settings' => 'slide_1_headline',
'type' => 'text'
)
)
);
// Slide 1 Text
$wp_customize->add_setting(
'slide_1_text',
array(
'default' => __( 'Slide 1 Text', 'manly-recipes' ),
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text'
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'manly_slide_1_text',
array(
'label' => __( 'Text', 'manly-recipes' ),
'section' => 'slide_1',
'settings' => 'slide_1_text',
'type' => 'text'
)
)
);
// Slide 1 Button Text
$wp_customize->add_setting(
'slide_1_button_text',
array(
'default' => __( 'Button Text', 'manly-recipes' ),
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text'
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'manly_slide_1_button_text',
array(
'label' => __( 'Button Text', 'manly-recipes' ),
'section' => 'slide_1',
'settings' => 'slide_1_button_text',
'type' => 'text'
)
)
);
// Slide 1 Button Link
$wp_customize->add_setting(
'slide_1_button_link',
array(
'default' => __( 'http://...', 'manly-recipes' ),
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text'
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'manly_slide_1_button_link',
array(
'label' => __( 'Enter the URL for the page you want the button to link to', 'manly-recipes' ),
'section' => 'slide_1',
'settings' => 'slide_1_button_link',
'type' => 'text'
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment