WP customize_register for Logo Upload

/* Customizer API*/

functions.php
function customize_api($custom_val){
$custom_val->add_section('general_section',array(
'title' => 'General Options',
'priority' => 20
));


$custom_val->add_setting('logo_img',array(
'default' => '',
'transport' => 'refresh'
));


$custom_val->add_control(
new WP_Customize_Image_Control($custom_val,'logo_img',array(
'section' => 'general_section',
'label' => 'Logo Uploader',
'settings' => 'logo_img'
))
);
}

add_action('customize_register','customize_api');

index.php
<img src="<?php echo get_theme_mod('logo_img'); ?>" alt="Logo">

Comments

Popular posts from this blog

Deploy laravel application to digital ocean droplet

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine