WordPress Atahualpa Theme – Different Header Images for MultiSite WP
My goal was to add different header images to different sites using the Atahualpa. I expect to upload these images via FTP. I am not trying to upload these like TwentyTen does so it can be used on WordPress.com. I have a couple dozen sites and uploading the headers with FTP suits me fine. The Atahualpa Theme was designed to upload header files via FTP.
My last post, Preventing WordPress Automatic Updates From Deleting Custom Settings (Themes and Plugins) I dealt with how to protect your custom files and gave an example using the Constructor Theme.
A day later I realized that Constructor could not send out CSS if the defaults for the domain did not point to WordPress. In other words, if when you just type the domain name into the browser, it does not go to WordPress. I have some sites that the default is owned by a different program and WordPress is started in the /biog/ directory. In that case no CSS was reaching the browser… Not a pretty site!
For Newer Easier Instructions Follow This Link…
So I went looking again and found Atahualpa 3.6.1.
The problem with Atahualpa was that it was really written for single site WordPress and the old MU. Not WP3.x It has no provision for different header images in WordPress 3.x in MultiSite Mode.
FYI – I am running Version 3.0.4 of WordPress, in MultiSite, with the WP Multi-Network plugin…
The Default Location
First I needed to find the code that got the Header files from the default location. I found the location easy enough…
wp-content/themes/atahualpa/images/header
It says that is where you should FTP the header images to. Two problems, first that directory is deleted each time Atahualpa is automatically updated. Second, I knew I needed someway to identify each header for each site.
The Program
The program code for this is…
wp-content/themes/atahualpa/functions/bfa_rotating_header_images.php
About line 28 you will find these two lines of code…
$imgpath = TEMPLATEPATH . '/images/header/'; $imgdir = $templateURI . '/images/header/';
I replace those two lines of code with this small program…
For Newer Easier Instructions Follow This Link…
// This was removed because the newer version is smaller, faster and more reliable. // Please use the above link and follow the instructions on the new page. Thanks, LAN
Where do you put the header images?
So after you make that one change and upload the file, all you need to do is create the directory and upload your images. The question is, where and what name?
Multi-Site Sub-Directory
Lets say your WordPress is a MultiSite that uses sub-directories. For example:
- example.com/blog-1/
- www.example.com/blog-2/
- example.com/site3/
Just change the dots (.) and slashes (/) (but no end slash) to dashes (-) and lose any www at the beginning. You would simply upload your header image files to the respective directories, for example.
- wp-content/blogs.dir/example–com-blog-1
- wp-content/blogs.dir/example–com-blog-2 (the www is gone!)
- wp-content/blogs.dir/example–com-site3
dots not dashes!
- wp-content/blogs.dir/example.com-blog-1
- wp-content/blogs.dir/example.com-blog-2 (the www is gone!)
- wp-content/blogs.dir/example.com-site3
Multi-Site Sub-Domain
Using Multi-Site in Sub-Domain mode, you use your domain name, without the www, and change the dots (.) into dashes (-)
For each of these sub-domains…
- example.com
- www.example.com (note that www will be removed)
- peter.example.com
- paul.example.com
- mary.example.com
You would upload to these directories respectively…
- wp-content/blogs.dir/example–com
- wp-content/blogs.dir/example–com (note that www is removed)
- wp-content/blogs.dir/peter–example–com
- wp-content/blogs.dir/paul–example–com
- wp-content/blogs.dir/mary–example–com
dots not dashes!
- wp-content/blogs.dir/example.com
- wp-content/blogs.dir/example.com (note that www is removed)
- wp-content/blogs.dir/peter.example.com
- wp-content/blogs.dir/paul.example.com
- wp-content/blogs.dir/mary.example.com
Multi-Site ~ Sub-Domain ~ Multi-Network plugin…
Multi-Network directories are exactly the same as the Multi-Site Sub-Domain. Here is an example.
The Multi-Network plugin allows you to do multi site / sub-domain across different domains, here called networks. Here is a real world example This site is running on.
- http://alantait.net/ or http://www.alantait.net/ ~~~ aLAN Tait Net Work!
- http://bmfg.net/blog/ ~~~ Business Men’s Fellowship Global
- http://acts-29.net/ or http://www.acts-29.net/ ~~~ ACTS-29 Network
- http://franciskong.acts-29.net/ ~~~ Francis Kong
- http://fgbmfi.net/blog/ ~~~ FGBMFI Networking!
- http://newliphe.org/ ~~~ New LipHe / New Life
- http://gamot.net/blog/ ~~~ Gamot Domain Names
- http://alantait.com/ ~~~ aLan Tait Live!
- http://ofws.net/ ~~~ Overseas Filipino Workers Network
- http://filipina.fil.net/blog/ or http://www.filipina.fil.net/blog/ ~~~ Filipina
Note that in every case the www is removed when making a directory. Likewise, each directory is created out of the unique domain name as is a part of the Multi-Network Sub-Domain
Migrating Note: At this time I am still migrating these development sites to Atahualpa. The following are working on Atahualpa at the time of this writing…
Filipina is working in the default image file mode.
aLAN Tait Net Work! is working in the custom image file mode.
- wp-content/blogs.dir/alantait-net
- wp-content/blogs.dir/bmfg-net
- wp-content/blogs.dir/acts-29-net
- wp-content/blogs.dir/franciskong-acts-29-net
- wp-content/blogs.dir/fgbmfi-net
- wp-content/blogs.dir/newliphe-org
- wp-content/blogs.dir/gamot-net
- wp-content/blogs.dir/alantait-com
- wp-content/blogs.dir/ofws-net
- wp-content/blogs.dir/filipina-fil-net
dots not dashes!
- wp-content/blogs.dir/alantait.net
- wp-content/blogs.dir/bmfg.net
- wp-content/blogs.dir/acts-29.net
- wp-content/blogs.dir/franciskong.acts-29.net
- wp-content/blogs.dir/fgbmfi.net
- wp-content/blogs.dir/newliphe.org
- wp-content/blogs.dir/gamot.net
- wp-content/blogs.dir/alantait.com
- wp-content/blogs.dir/ofws.net
- wp-content/blogs.dir/filipina.fil.net
If the theme author wishes to write a program to upload header images from the wp-admin pages (in a way like TwentyTen), the wp_upload_dir() function could be used and line 21 uncommented.
However, this works just fine for FTP and that is all I needed!
Codifically,
LAN Tait
Cheers for the guide. Any ideas where I can get any 1300 px wifth headers for atahualpa?
You can Google for stock photos, look for panoramic views. Then use a program like GIMP. You can also take a higher resolution photo and resize it, then cut a strip as needed. The above are actually the heading from the 2010 WP Theme, I just stretched them to 1300px. It works for most nature scenes because you do not notice the distortion. I used the program GIMP running in Ubuntu to make the above headers.
Likewise, you could take two or more images and combine them together in GIMP. I am not saying GIMP does everything, but for making headers it does enough!
Hey, I looked at your excel project. Those of you still using Windows (who haven’t made the move to Ubuntu yet) might find some useful tips on this site.