-
-
Notifications
You must be signed in to change notification settings - Fork 28
Filter Hook for Favicon File Path
bueltge edited this page Oct 23, 2014
·
4 revisions
On default checks the plugin the active Theme directory for the favicon.ico
.
If you use a theme, there have a other structure or a Multisite with different Sites with the same theme, the use the filter hook fir define the favicon path. See the follow example. Use it to create a custom plugin for your requirements.
/**
* Plugin Name: Set my custom Favicon Path
* Description: Filter the default favicon path for Multisite Enhancement
* Version: 0.0.1
* Author: Frank Bültge
* Author URI: http://bueltge.de/
*/
add_filter( 'multisite_enhancements_favicon_path', 'fb_favicon_path' );
/**
* Tell Multisite Enhancements plugin where to find favicon in Genesis child themes.
*
* @return string File path to favicon file.
*/
function fb_favicon_path() {
return '/images/favicon.ico';
}
Included via Pull Request #6 by @GaryJones Released in Version 1.0.5
/**
* Plugin Name: Set my custom Favicon Path
* Description: Example filter function for plugin or theme (this is for a CobaltApps Dynamik theme)
* Version: 0.0.2
* Author: JoryHogeveen
* Author URI: https://github.com/JoryHogeveen
*/
add_filter( 'multisite_enhancements_favicon_path', 'fb_favicon_path', 10, 3 );
function fb_favicon_path($default, $id, $path_type) {
$path = '';
switch ( $path_type ) {
case 'dir':
$path = $_SERVER['DOCUMENT_ROOT'] . '/';
break;
case 'url':
default:
$path = network_home_url();
break;
}
if ( 'dynamik-gen' === get_blog_option( $id, 'stylesheet' ) ) {
return $path . 'wp-content/uploads/sites/ ' . $id . '/dynamik-gen/theme/images/favicon.png';
} else {
return $default;
}
}
Included via Pull Request #12 by @JoryHogeveen Released in Version 1.0.7
Other WordPress Multisite Solution in my network:
- MultilingualPress The right way to build a multilingual WordPress site!