Skip to content

Instantly share code, notes, and snippets.

@brianpurkiss
Created December 27, 2018 19:03
Show Gist options
  • Save brianpurkiss/941a85738a59937a879aafc693319ed8 to your computer and use it in GitHub Desktop.
Save brianpurkiss/941a85738a59937a879aafc693319ed8 to your computer and use it in GitHub Desktop.
Adding a favicon to WordPress through functions
<?php
// Setup favicon call
function add_favicon() {
$favicon_url = get_stylesheet_directory_uri() . '/library/images/favicon.png';
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
}
// Adds favicon to WP Frontend and WP Dashboard
add_action('wp_head', 'add_favicon');
add_action('login_head', 'add_favicon');
add_action('admin_head', 'add_favicon');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment