barukar (August 13th, 2013)
// Print HTML code that references the child theme's favicon.
// In this case, the favicon.ico file is located in the same directory as the child theme's style.css file.
function childtheme_add_favicon_reference () {
echo '<link rel="Shortcut Icon" type="image/x-icon" href="' . get_stylesheet_directory_uri() . '/favicon.ico" />' . "\n";
}
// Unhook the ClassiPress function that sets up the ClassiPress favicon.
// If successful in unhooking it, hook child theme counterpart to same hook (effectively replacing the CP functions with the child theme's).
function childtheme_override_cp_favicon_function () {
// Unhook ClassiPress function. If successful, hook child theme function.
if ( remove_action( 'wp_head', 'appthemes_favicon' ) ) {
add_action('wp_head', 'childtheme_add_favicon_reference');
}
// Unhook ClassiPress function. If successful, hook child theme function (for admin pages).
if ( remove_action( 'admin_head', 'appthemes_favicon' ) ) {
add_action('admin_head', 'childtheme_add_favicon_reference');
}
}
// Hook the function that unhooks the CP function and that hooks the child theme function.
add_action('init', 'childtheme_override_cp_favicon_function');
barukar (August 13th, 2013)
There are currently 1 users browsing this thread. (0 members and 1 guests)