Blog Banner Images is a WordPress MU plug-in that enables individual MU blogs that share an overarching theme to have their own banners.
Version 1.0 added August 14, 2009!
Download version 1.0 from the WordPress MU plugin repository »
Description
Allow individual bloggers in a basic WordPress MU environment to easily upload and associate a primary image with their blog. Just attach a new image from anywhere in a blog’s administration (page / post editor, or by going to “Add New” under Media), and make sure the title of the attachment is “banner”! Bloggers can assign an existing image the “banner” title, and can delete the banner if they no longer wish to have one.
Template authors can easily integrate with any template by using a simple function to output the image. The image name is cached in an option for quick retrieval and low overhead.
This idea for this simple plug-in came out of a MU project where all of the blogs shared a central theme with the primary blog. The original project theme called for an optional, unique banner image atop any blog, and an simple means for bloggers to provide their banner.
Installation & Usage
To install, just upload the single PHP file (mu_blog_banners.php) to the “mu-plugins” folder under “wp-content”.
The full image tag can be output using the “show_blog_banner” function. The function takes two optional parameters:
- “alt value” – the “alt tag” value for the image (defaults to the blog name).
- “blog id” – ID of the blog whose banner you want to retrieve (defaults to the current blog)
For instance, if you want to show the current blog’s banner, and use the blog tagline for the alt tag, use:
show_blog_banner(get_bloginfo('description'));
If you only want to retrieve the image path for the banner, you can use the “get_blog_banner_src” function, which has 1 parameter (blog ID). Note that this returns the source, and does not display (echo) it.
This has only been fully tested with the latest version of WordPress MU as of its release: 2.8.1. It should work in previous versions that support attachment hooks, including 2.7 builds.
Screenshots
As always, feedback and suggestions are welcome!
I want to make a donation, but is a constant problem.
images – what’s the problem?
Do you have to put that code anywhere? show_blog_banner();? I uploaded the .php provided file to the mu-plugins, and uploaded a random image to my media library, titled it as “banner” and it didn’t display as the header image. So I was wondering if header.php or some other file needed to be edited to reflect that code above, or if another setting I am missing? Thanks!
Hi Brian: Yes – you need to tell the template where you want the banner to be output. You can put the “show_blog_banner();” function in any of your template files, including the header file, where you want the banner to appear.