Use Custom Footer Across Multiple Genesis Themes in WordPress MultiSite
I’ve recently helped launch a number of projects that use WordPress MultiSite heavily, including MennoSites.ca and OurTownSite.ca. This post outlines how to quickly and easily setup a simple WordPress plugin to let you add the same custom footer to every Genesis Theme in your WordPress MultiSite install.
I’ve used a number of Theme suppliers working with WordPress over the years. Lately I’ve begun using Themes based on the Genesis Framework almost exclusively. When I started working with Genesis I took a look around to see what was the best way to change the Theme footer and include my own content. I found this code snippet on the StudioPress site that does exactly what I wanted.
I found this code snippet on the StudioPress site that does exactly what I wanted.
/** Customize the credits */
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text($creds) {
$creds = 'Copyright © · <a href="http://mydomain.com">My Custom Link</a> · Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
return $creds;
}
If you copy and paste this code into your Child Themes function file, you can quickly and easily modify the Themes footer.
I wanted to make a few changes to customize the footer for MennoSites.ca. I wanted to display a copyright notice for the current website, a link to the main MennoSites.ca site and a link to the WordPress Administration area for the current site. I used the PHP date
function to display the current year for the copyright notice. Than I used the WordPress site_url()
function and the WordPress variable $blog_title
together create a link to with the name of the current site and its address for the copyright notice. After that I simply hard-coded a link to MennoSites. Finally I used the WordPress site_url()
function one last time to create a link to the current sites WordPress Administration Section. You can see the code snippet I'm using below.
/** Customize the credits */
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text($creds) {
$blog_title = get_bloginfo();
$creds = 'Copyright (C) '.date(Y).' · <a href="'.site_url().'">'.$blog_title.'</a> · Part of the <a href="http://mennosites.ca" title="MennoSites.ca Network">MennoSites.ca Network</a> · <a href="'.site_url().'/wp-admin/" title="Website Admin">Website Admin</a>';
return $creds;
}
This snippet is in use on MennoSites.ca and you can actually see it being used at the bottom of this page. Using date(Y)
,.site_url
,$blog_title
means that our copyright information is always up to date, and that this snippet will work on any WordPress Site using a Genesis Theme without any other modifications. The snippet will always display the correct links for whatever site it is added too.
On MennoSites.ca we have dozens of Genesis Themes available, instead of adding this snippet to the functions.php file of every theme I wanted to have one location where I could add this snippet and modify it in the future. Using the extensible power of WordPress I created a simple plugin to do exactly that.
To do the same thing, just create a file called easy-genesis-footer.php and open it with your favourite editor. Now add the following code to your file.
<?php
/* Plugin Name: MennoSites.ca Easy Genesis Footer Plugin
URI: http://mennosites.ca
Description: Manage The Footer For Your Genesis Themes All In One Place.
Version: 1.0
Author: Matthew Siemens
Author URI: http://matthewsiemens.com
License: GPL2 */
?>
Now just add the code snippet from above so that your file looks like this.
<?php
Plugin Name: MennoSites.ca Easy Genesis Footer
Plugin URI: http://mennosites.ca
Description: Manage The Footer For Your Genesis Themes All In One Place.
Version: 1.0
Author: Matthew Siemens
Author URI: http://matthewsiemens.com
License: GPL2
*/
/** Customize the credits */
add_filter('genesis_footer_creds_text', 'custom_footer_creds_text');
function custom_footer_creds_text($creds) {
$blog_title = get_bloginfo();
$creds = 'Copyright (C) '.date(Y).' · <a href="'.site_url().'">'.$blog_title.'</a> · Part of the <a href="http://mennosites.ca" title="MennoSites.ca Network">MennoSites.ca Network</a> · <a href="'.site_url().'/wp-admin/" title="Website Admin">Website Admin</a>';
return $creds;
}
?>
Just remove the link to MennoSites.ca and replace it with a link to your own website. On your web host create a folder called mu-plugins inside wp-content if one doesn't already exist and upload the file you created to it. This will force the plugin to be enabled across your WordPress MultiSite network, and will update and display your new footer automatically. Please only use this plugin if you are only using Genesis Themes on your MultiSite setup, or you might run into some issues.
I hope this information was helpful, I know it's saved me from modifying dozens of functions.php files every time I want to make a change to the footer.