Here is the Custom function to add website logo from wordpess admin and you need to this script into your theme's functions.php file:
//Add Menu in admin dashboard
function add_theme_menu_item(){add_menu_page("Theme Options", "Theme Options", "manage_options", "theme-panel", "theme_settings_page", null, 99)\}
// Add Html code to that menu
add_action("admin_menu", "add_theme_menu_item");
function theme_settings_page()
{
?>
<div class="wrap">
<h1>Theme Options</h1>
<form method="post" action="options.php" enctype="multipart/form-data">
<?php
settings_fields("section");
do_settings_sections("theme-options");
submit_button();
?>
</form>
</div>
<?php
}
function logo_display()
{
?>
<input type="file" name="logo" />
<?php echo "<img style='width:150px; height:150px;display:block;' src='".get_option('logo')."'>";
}
//Upload Logo
function handle_logo_upload()
{
global $option;
if($_FILES["logo"]["tmp_name"])
{
$urls = wp_handle_upload($_FILES["logo"], array('test_form' => FALSE));
$temp = $urls["url"];
return $temp;
}
return $option;
}
function display_theme_panel_fields()
{
add_settings_section("section", "Logo Settings", null, "theme-options");
add_settings_field("logo", "Add Logo", "logo_display", "theme-options", "section");
register_setting("section", "logo", "handle_logo_upload");
}
add_action("admin_init", "display_theme_panel_fields");
//To get logo src here is the code:
get_option('logo')