I have the following function in my function.php file;

function customize_images($wp_customize){

$wp_customize->add_section( 'customize_images_save', array(
    'title'    => __('Custom Image', 'themename'),
    'description' => 'Select Image',
    'priority' => 120,
));

    $wp_customize->add_setting( 'image_option', array(
        'default'           => 'image.jpg',
        'capability'        => 'edit_theme_options',
        'type'           => 'option',

    ));

    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'image_option', array(
        'label'    => __('Select Image', 'themename'),
        'description' => '',
        'section'  => 'customize_images_save',
        'settings' => 'image_option',
        'priority'    => 10,
    )));

}

which is supposed to add a custom section in my WordPress customize menu.

Then the following codes to display the image in my home-page.php file;

<?php 
    $my_image_top = get_theme_mod( 'image_option', 'default.jpg' );
    $image_top = wp_get_attachment_image_src( $my_image_top , 'full' ); 
?>

<img src="<?php echo $image_top ?>">

Unfortunately it’s not displaying anything and it’s just returning a blank . I’ve been struggling to find the error, any help?

Read more here: wp_customize image upload not showing up any image


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: