Add this code to your theme functions.php file

<?php

function exception_theme_customizer( $wp_customize )

{
$wp_customize->add_section( ‘exception_logo_section’ , array(
‘title’       => __( ‘Logo’, ‘exception’ ),
‘priority’    => 30,
‘description’ => ‘Upload a logo to replace the default site name and description in the header’,
) );

$wp_customize->add_setting( ‘exception_logo’ );

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘exception_logo’, array(
‘label’    => __( ‘Logo’, ‘exception’ ),
‘section’  => ‘exception_logo_section’,
‘settings’ => ‘exception_logo’,
) ) );

$wp_customize->add_panel( ‘exception_homepage_panel’, array(
‘priority’ => 10,
‘capability’ => ‘edit_theme_options’,
‘theme_supports’ => ”,
‘title’ => __( ‘Homepage Setting’, ‘exception’ ),
‘description’ => __( ‘Description of what this panel does.’, ‘exception’ ),
) );

$wp_customize->add_section( ‘exception_service_section’ , array(
‘title’       => __( ‘Service Section’, ‘exception’ ),
‘priority’    => 30,
‘description’ => ‘Upload a logo to replace the default site name and description in the header’,
‘panel’ => ‘exception_homepage_panel’,
) );

$wp_customize->add_setting( ‘exception_service_img1’ );

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘exception_service_img1’, array(
‘label’    => __( ‘Service Images 1’, ‘exception’ ),
‘section’  => ‘exception_service_section’,
‘settings’ => ‘exception_service_img1’,
) ) );

$wp_customize->add_setting( ‘exception_service_title1’, array(
‘default’ => ”,
‘type’ => ‘theme_mod’,
‘capability’ => ‘edit_theme_options’,
‘transport’ => ”,
‘sanitize_callback’ => ‘sanitize_text_field’,
) );

$wp_customize->add_control( ‘exception_service_title1’, array(
‘type’ => ‘text’,
‘priority’ => 10,
‘section’ => ‘exception_service_section’,
‘label’ => __( ‘Service Title 1’, ‘exception’ ),
‘description’ => ”,
) );

$wp_customize->add_setting( ‘exception_service_desc1’, array(
‘default’ => ”,
‘type’ => ‘theme_mod’,
‘capability’ => ‘edit_theme_options’,
‘transport’ => ”,
‘sanitize_callback’ => ‘esc_textarea’,
) );

$wp_customize->add_control( ‘exception_service_desc1’, array(
‘type’ => ‘textarea’,
‘priority’ => 10,
‘section’ => ‘exception_service_section’,
‘label’ => __( ‘Service Description 1’, ‘exception’ ),
‘description’ => ”,
) );

}
add_action( ‘customize_register’, ‘exception_theme_customizer’ );

?>

display customize contect on you want to call function get_theme_mod(“setting name”); setting name is a you create above code on add_setting(); function like a add_setting(“exception_logo”); exception_logo is a setting name. you want to use like image display <img src=”<?php echo get_theme_mod(‘exception_logo’); ?>” /> and text diplay you want to add <p><?php echo get_theme_mod(“exception_services_desc”‘); ?></p>

Advertisements