WordPress MultiSite, WP Multi Network, Atahualpa Theme, Easy Header Images
This represents an easy way to add header images to MultiSite or Multi Network installations of WordPress. This is now just a few steps…
Just download the zip file, unpack, upload the three files to your server, create the new directories, and upload your header images.
Download the zip file.
Just point your browser to:
http://alantait.net/alantait.net/atahualpa/atahualpa_custom.zip
Username: atahualpa
Password: custom
Unzip
Gee, you already know how to do that!
Upload the Three Files to Your Server
Atahualpa 3.6.1
If you are using Atahualpa 3.6.1 you can just copy the files to your server with your favorite FTP program. Just replace the files that are there in these two directories.
themes/atahualpa
functions.php
themes/atahualpa/functions
bfa_rotating_header_images.php
bfa_custom_site_dir.php
Atahualpa Other (manual)
If you are not on 3.6.1 Follow the manual upload instructions below… OR upgrade to 3.6.1 first!
Create the New Directories
You will need a new header directory for each of your sites.
Find your wp-content
You need this directory structure for each site.
wp-content/blogs.dir/example.com/images/header
That Means:
Using your FTP Program:
In the wp-content directory create a directory that is blogs.dir (if it doesn’t already exist).
In the blogs.dir directory create a directory that is your domain name.
To find your domain name, look at the address bar.
Mine says: http://alantait.net/
The domain name is between the two slashes // and the very next slash /
DO NOT include any www. if you are using that.
So http://www.blog.example.com/ would be a directory called blog.example.com
In your domain name directory create a directory that is images.
In the images directory create a directory that is header.
Upload Your Header Images
Upload your header images into the header directory.
You Are Finished!
Just give it a try!
Manual Upload Instructions
For those Not using Atahualpa 3.6.1 You can try this…
Download the zip file.
Same As Above…
Unzip
Same As Above…
Upload ONE File to Your Server
See instructions above for downloading, however upload only one file into this directory:
themes/atahualpa/functions
bfa_custom_site_dir.php
Modify
themes/atahualpa/functions
bfa_rotating_header_images.php
Replace This:
[php] $imgpath = TEMPLATEPATH . ‘/images/header/’;$imgdir = $templateURI . ‘/images/header/’;
[/php]
With This:
[php] if ( is_dir( BFA_CUSTOM_DIR . ‘/images/header/’ ) ) {$imgpath = BFA_CUSTOM_DIR . ‘/images/header/’ ;
$imgdir = BFA_CUSTOM_URL . ‘/images/header/’ ;
} else {
$imgpath = TEMPLATEPATH . ‘/images/header/’ ;
$imgdir = $templateURI . ‘/images/header/’ ;
}
[/php]
Modify
themes/atahualpa
functions.php
Replace This:
[php] include_once (TEMPLATEPATH . ‘/functions/bfa_header_config.php’);[/php]
With This:
[php] include_once (TEMPLATEPATH . ‘/functions/bfa_custom_site_dir.php’);include_once (TEMPLATEPATH . ‘/functions/bfa_header_config.php’);
[/php]
Create the New Directories
Same As Above…
Upload Your Header Images
Same As Above…
You Are Finished!
Just give it a try!
———————————————
THE ORIGINAL POST IS AT…
http://alantait.net/2011/01/13/wordpress-atahualpa-theme-different-header-images-for-multisite-wp/
———————————————
MultiSite Sub-Directory Users
Warning: Do Not use these instructions for a single site, a multisite subdomain, or a WP Multi Network site.
When you use multisite in sub-directory mode, there is no unique domain name, so the directory structure changes slightly… this is ONLY for sub-DIRECTORY mode, if you set that up at the very start of your WordPress install.
Here is how sub-directory sites would look…
http://www.example.com/peter/ http://www.example.com/paul/ http://www.example.com/mary/
The instructions are the same, except you need to add a dash (-) Plus the sub-directory.
wp-content/blogs.dir/example.com–directory/images/header
Where:
example.com = Your Domain Name (no www.)
directory = Your Sub-Directory
EXAMPLES
http://example.com/peter/ http://www.example.com/peter/ wp-content/blogs.dir/example.com-peter/images/header
http://example.com/paul/ http://www.example.com/paul/ wp-content/blogs.dir/example.com-paul/images/header
http://example.com/mary/ http://www.example.com/mary/ wp-content/blogs.dir/example.com-mary/images/header
——————————————–
Question, Can this be used to protect custom header image files from being deleted during automatic updates?
Yes, even in single site mode!
From one standard site, all the way through Multi Networks with multisites, this mod may be used to safeguard custom image files from being deleted during automatic or manual updates.
Likewise, the mod has automatic fall back to the default files for sites without custom header image files.
Example 1: Say you are running multisite mode with a dozen sites. You add a new site, but you do not have header images yet. No problem, the default images will be served until you add your custom image directories. No setting needed!
Example 2: Say you are running in single site mode with this mod to protect your header image files, logo files, favicons, etc. You decide to activate multisite mode and create another site on a subdomain. Automatically the second site is being served the default header image files while the original site is still being served the custom protected header image files… Plus anything else in the first custom directory, like logos, favicons, etc.
————————————
Question, why the empty image directory?
The empty image directory mirrors the theme file structure. However, this directory is a convenient place to put things like logo files on a per site basis.
Likewise we will be looking at additional site customization issues regarding theme updates, multisite, and WP Multi Network sites and will be using this for storage of unique files in this regard.
For example, a custom site may need logo files, icon files, footer or sidebar image files, and header files. This gives a place that will not be overwritten with each theme update and would allow the use of automatic updates without loss.
I tried to follow these instructions, and realized that it won’t work for sub-directories. I would really appreciate it if you could explain what has to be changed to make this function on subdirectories.
Thanks,
Nathan
Nathan, subdirectories are a little more tricky…
Because I do not have a working wordPress with suddirectories I cannot test the code locally.
However…
I checked click-sandiego.com but it has the Twenty-Ten Theme. The Atahualpa Theme WILL run, just out of the Box, on a WordPress Multisite install. There are just some unique customization problems this addresses.
1) Do you have two or more subdirectory sites already working with the Atahualpa Theme on them?
If yes, then what are the sub-sites?
If no, to use this in subdirectory mode you must have WP3 in multisite, subdirectory mode FIRST!
2) Did you create the subdirectories in the proper place?
If you are using a new install, you will likely use a structure like this…
For:
click-sandiego.com/mary
Put your headers in:
wp-content/blogs.dir/click-sandiego.com-mary/images/header
For:
click-sandiego.com/nathan
Put your headers in:
wp-content/blogs.dir/click-sandiego.com-nathan/images/header
Note: The slash before the directory was changed into a dash in the directory structure.
I have not tested it in subdirectory mode, however I am willing to work with you on this as it is not a very complex process.
If you can post the an actually example (the URL’s to your sites) this would be easier to advise you.
Lan
Hi Lan,
Thanks for the post, it answered a question that’s been bugging me for some time. One problem though…
Now, whenever I upgrade to a new version of Atahualpa, I have to remember to preserve your modified .php files. While that’s not such a big deal, it does mean that I won’t get any updates to these files from BytesForAll – and that could eventually break the theme.
To get around this, I had a go at creating a child theme to contain your files. The trouble is, as I understand it, files in child themes are simply appended to their equivalents in the main theme, which makes it tricky to change specific lines of code.
Any suggestion?
Hi Andrew!
As you have noted, each time Atahualpa is updated, the mods will not be in the BytesForAll package.
Here is the situation…
The mod you have only addresses the rotating header problem. However, there is another lesser problem, the the Favicon and Logo files – also Per Site!
So I got into it and I have had version 2 under test about 3 weeks while I was dealing with funerals and the loss of one of my dearest friends.
Well, now I am back and I am packaging it and will post about it very soon (Before March 1).
This package is so stable it could EASILY be added to the BytesForAll program on a permanent basis. (I will give it to them!)
It provides some single site benefits as well as complete image support for MultiSite SubDomain, Multisite SubDirectory, WPMU, Single Site, and Multisite with the WP MultiNetwork plugin!
All Images are uploaded via the Upload Program in WordPress.
Therefore, it could be permanently merged into the BytesForAll code, if they choose.
In the mean time, I will be publishing an update package for the five files for each new version of Atahualpa.
I am actually doing this for a couple dozen sites I am supporting.
This new package, will just mean waiting a day or two, downloading the 5 file package. Upload the new Atahualpa package and then upload (replace) the five files on top of the new Atahualpa.
If BytesForAll accepts and merges my mods into their core, then even one touch updates from the WordPress site will work properly. (Currently any custom files are deleted when you upload from the WordPress site.)
We can always hope BytesForAll will like the mod, and will add it permanently.
Codifically,
Lan
Lan,
What about child theme support, either additionally or instead?
I am working on a patch that will have bfa_rotating_header_images.php look first for an images/header/ subdir in the child theme directory, and if it is found it will use that instead of the images/header/ subdir in the atahualpa theme directory. It would/should be pretty easy to have it also check your BFA_CUSTOM_* area, too.
H
@Harlan – yes, that should work also. I would look at the last version…
http://alantait.net/2011/02/26/ultimate-wordpress-multisite-wp-multi-network-atahualpa-mod/
It could be argued that the last version does not need the child theme support as it allows complete separation. Likewise if Bytes For All makes this mod a permanent part of their code, then this will be a part of the child theme support automatically.
Harlan,
The Ultimate WordPress MultiSite, WP Multi Network, Atahualpa Mod defaults to the standard directories IF there is no custom directory specified.
This is on a per site basis.
Thanks for you help. It helps me a lot to find the solution.
Looking at your solution help me to build my own solution. I did not understand the purpose of BFA_CUSTOM_DIR and the dedicated php file. Why not using the default function included in the wordpress framework wp_upload_dir() to get the correct path ? Maybe I missed something ?
In my solution I replaced the two lines:
$imgpath = TEMPLATEPATH . ‘/images/header/’;
$imgdir = $templateURI . ‘/images/header/’;
by
# PHB 2011 04 20 – Add 5 lines to get the dedicated blog path and URL
$uploads = wp_upload_dir();
if ( is_dir( $uploads[‘basedir’] . ‘/header/’ ) ) {
$imgpath = $uploads[‘basedir’] . ‘/header/’;
$imgdir = $uploads[‘baseurl’] . ‘/header/’;
}else{
$imgpath = TEMPLATEPATH . ‘/images/header/’;
$imgdir = $templateURI . ‘/images/header/’;
}
#PHB 2011 04 20 – end of change
And that’s all. This solution work well with
Atahualpa 3.6.4 on WordPress 3.1.1 with sub-sites.
Not tested with subdirectory.
Best regards
Phil
Hi Phil,
This is one of those timing things overlap…
On February 26th, 2011 I released the Ultimate WordPress MultiSite, WP Multi Network, Atahualpa Mod
This is basically Version 2.0 and it not only used wp_upload_dir() to fix what Phil is talking about, it also allows uploading of the header images, the logo image and the favicon via the WordPress image uploader – from withing WordPress. I would highly suggest moving to the Ultimate WordPress MultiSite, WP Multi Network, Atahualpa Mod as this is what we are using in about 3 dozen sites and others are also finding it to be much easier – just upload it and forget it!
Your solution would likely work with subdirectories. However, the Version 2.0 is working in all modes (even single mode with uploads via the image uploader) and makes things so easy (no manual ftp uploading at all) that it seems wise to use Version 2.0.
Lan,
sorry for my OT question. I would like to know what settings I’ve to change to obtain the shadow that this page has along the left & right borders. Thank you very much in advance for your support.
Overall Style & Config. ~ Style & configure LAYOUT
I have the following… (That should push you in the right direction…)
Layout WIDTH and type (FLUID or FIXED): 95%
Layout Container Style:
margin-left:auto;
margin-right:auto;*/
padding:20px;
background:#fff;
box-shadow:0 0 15px #333;
-moz-box-shadow:0 0 15px #333;
width:auto;
text-align:left;
display:block;
Layout Container Padding Left/Right: 20
I’m not sure what I’m doing wrong on this… I’m trying to do a multisite with atahualpa 3.6.7 with a child theme. I followed the directions above but get this error: Fatal error: Call to undefined function bfa_incl() in /home/erinflyn/public_html/wp-content/themes/atahualpa/header.php on line 44
What am I doing wrong?
Thank you!
Okay, I figured out what I was doing wrong to get the error… however, now my header images just don’t show up at all…?
you need to edit your about page… then up load your header images while editing your about page…