Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Different header images for MU Blogs? (http://forum.bytesforall.com/showthread.php?t=7557)

wadams92101 Jun 12, 2010 06:06 PM

Different header images for MU Blogs?
 
I've got an MU installation and want different headers for each of the blogs. Is there a way to do it with Atahualpa? Right now I'm using the Atahualpa header for Main blog but on the sub-blogs I'm replacing the theme header images with the dynamic header plugin. However, that results in a really slow load. Is there a way to do it within the Atahualpa theme?

wadams92101 Jun 15, 2010 11:38 AM

Anyone? :confused:

wadams92101 Jun 19, 2010 01:06 PM

Has everyone taken a World Cup hiatus?

wadams92101 Jun 25, 2010 06:02 PM

Ok, So as to close this unanswered post, I'll assume that means its not possible.

juggledad Jun 26, 2010 04:05 PM

what version of Atahualpa and WP?
I haven't had much reason to play with MU and don't have a test site setup
Have you tried the built in rotating headers?

talynndar Jun 27, 2010 11:07 AM

I am looking for same answer...

the built in rotating headers will give you the same headers on multiple blogs

I think the original poster and myself looking for a way to do a different header on each blog

so I have mainblog.com - that will rotate headers
and then I have jane.mainblog.com will have jane header
and then mary.mainblog.com would only have mary header

I thought maybe this could be done by uploading a maryheader.jpg in a folder called maryheader vs header and then calling the %image from that folder only or maybe calling %maryimage

so the easy fix would be uploading a few files and then editing the theme within the theme options editing in the backend of that particular blog. Any edits made in the main theme on WPMU would apply to all blogs

but am lost at where the %image is created and called on?

am happy to send paypal for help on this one :)

wadams92101 Jun 30, 2010 01:57 AM

@talynndar - Exactly.

@Juggledad - WP 3.0; Ata 351; As said by Tal, rotating headers gives me same rotation on all blogs. I'm looking for permanent different headers on different blogs. That would make the theme really MU friendly. Maybe engineer for 352?

johanM Jul 1, 2010 02:55 PM

in bfa_rotating_header_images.php, comment as in the code

Code:

// if (file_exists(ABSPATH."/wpmu-settings.php")) {
      ................
// }

//    if ( !file_exists( ABSPATH."/wpmu-settings.php" ) OR !$files ) {   
    if ( !$files ) {  // <====== change to this
            .........
    }

perhaps you need to modify .htaccess as

Code:

#upload files
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

that would be enough

wadams92101 Jul 5, 2010 03:15 PM

Thank Johan. I've been away from this thread for awhile and just saw your reply. I'll give it a try and report back. :)

Aubergine Jul 13, 2010 09:32 AM

Thanks to Johan for posting a possible fix. I made the changes to WP 3.0 MU with Atahualpa3.5.1, with an added test site on my web host. The changes did no harm to either site, but on the test blog, header images still load from the main site. I placed the header image for the test site in its files folder (not in the year/month folder). I found a place in the functions file that looks for wpmu-settings.php and changed it to ms-settings.php.

Perhaps a temporary kludge would be to install a copy of Atahualpa in the themes folder (named Atahualpa351-sitename) and use it with the added site?

Aubergine Jul 14, 2010 05:20 AM

I found a simple fix for the short-term. In CPanel, I added an images folder under the site's "files" folder. Added the desired header image to it and added an overriding style to ATO Options, Add HTML/CSS Inserts, using the !important property. It worked in FF, IE, and Chrome.

#imagecontainer.header-image-container {
background: url('<?php bloginfo('url'); ?>/files/images/filename.jpg') top left no-repeat !important;
}

Easy to change later, if Atahualpa folds in this feature in a future release, and it won't break if the same procedure is used with multiple blogs.

tsotsi Jul 14, 2010 11:08 AM

Thanks Aubergine!

you specify a "filename.jpg" for the headerimage. Does that mean, rotating headers are not working in this fix and you can only use one single image here?

Aubergine Jul 15, 2010 06:52 AM

Yes, a single image. I'm making a site for someone who is wants one header image on each of several subdomains. In that situation, the CSS bandaid works.

Otherwise, the theme code would need to be edited to look inside the individual site folders for the array of images or look into sub-folders of the /images/header folder and use ones with a certain filename pattern. I just don't have time to mess with that, or more accurately, make a mess with that.

Since there are still WPMU sites out there, with site files in a different folder, revisions to the theme would be a little tricky, but I hope this feature will be added in the future. Atahualpa is well-suited for multisites, since it's so easy to tweak options for each site, and the new Menus work fine with it as widgets.

wadams92101 Jul 15, 2010 12:22 PM

Thanks Aubergine for that solution! & BFA, I hope you guys are in the workshop to add the different rotating images for multi-site feature for a future release of your wonderful theme!

johanM Jul 15, 2010 03:11 PM

Mine wp3 was upgraded from wpmu 2.9, tested it at my local computer with localhost, sub-directory configuration, I don't have any issue with this change. According to wp3, there is no need to specify the UPLOADBLOGSDIR in wp-config.php because it set automatically unless you want to change the blog dir to another relative path, and the files will be uploaded to "wp-content/bolgs.dir/<blog_id>/files/". According to ata3, your header images will need to have a prefix as atahualpa_header_; in my case, I change it to

$files = m_find_in_dir(get_option('upload_path'), 'atahualpa/header_[0-9]+\.(jpe?g|png|gif|bmp)$'); // was atahualpa_header_

and created an 'atahualpa' directory and changed the prefix to header_ under that directory, somehow, I don't think it does any matter. Don't forget your .htaccess, you will need to copy the code from dashboard's network tool setting. You should have a line as

Code:

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

One interesting thing is wp3 seems can only read files under directory /files. I had tried to create a images directory as <blog_id>/images, but images cannot be loaded from there.

Aubergine Jul 17, 2010 09:28 AM

wadams92101, after working with this a bit more, I decided to add all the site-specific images within the atahualpa351/images folder so that they would be available to all added sites with similar color schemes. To keep maintenance easier, I added separate folders for siteheaders, sitebackgrounds, and sitegraphics. To reference these graphics, I used 'template_directory' instead of 'url' in the CSS, so the url shown in my earlier post would become:

#imagecontainer.header-image-container {
background: url('<?php bloginfo('template_directory'); ?>/images/siteheaders/filename.jpg') top left no-repeat !important;
}

I am also going to experiment with the solution in Johan's latest post for header images that are unique to a single site. Doing it that way would be nice in situations where rotating banners are necessary, or for a small group of sites that are stylistically very different, or for those folks who host blogs for other people on their own sites and want to keep their stuff separated (especially useful when a site is deleted and you want their images to go poof).

Aubergine Jul 19, 2010 05:56 PM

Johan's solution works great! Since I did not upgrade from WPMU, I had to change:

ABSPATH."/wpmu-settings.php"
to
ABSPATH."/wp-includes/ms-settings.php"

where it occurs, in these Atahualpa theme files:
functions.php
bfa_header_config.php
bfa_rotating_header_images.php

I also used his suggestion to add an atahualpa folder to the wp-content/blogs.dir/[blog#]/files folder and put the files there, using the expected file names, header_1, header_2, ...

The sites that use my /images/siteheaders folder still work fine, but now I can use rotating headers as needed. Whoo hoo! Thanks again, Johan!

johanM Jul 20, 2010 10:01 AM


WOW, I didn't know wpmu-setting.php were in those files. Thank you Aubergine to point it out. I now change it in all three files.

I also just learned you can also replace "if ( file_exists(ABSPATH."/wpmu-settings.php") )' line with ' if ( defined('WP_ALLOW_MULTISITE')' )",

in bfa_rotating_header_images.php: replace

Code:

  if (file_exists(ABSPATH."/wpmu-settings.php")) {

        ################### images in WP upload folder (on WPMU)
....

  if (!file_exists(ABSPATH."/wpmu-settings.php") OR !$files ) {
....

with

Code:

      if ( defined('WP_ALLOW_MULTISITE') ) {

      include_once (TEMPLATEPATH . '/functions/bfa_m_find_in_dir.php'); // this line no need if you have changed it in ata/functions.php

      ################### images in WP upload folder (on WPMU)
.....

        if ( !defined('WP_ALLOW_MULTISITE') OR !$files ) {
...



It should work with all wp and ata3 versions and may be a better solution. :)



tsotsi Jul 20, 2010 12:02 PM

Thanks Johan and Aubergine.

Does that mean now that ONLY the lines in "bfa_rotating_header_images.php" have to be changed as Johan described AND each <blog_id> has to have an /images folder where the headerimages have to be placed? If this is NOT right, could you make a step by step instruction or just verify the approach.

I am using WP 3 and Ata352
Thanks

Aubergine Jul 20, 2010 06:19 PM

Johan will need to answer your question about the file changes. I don't know.

What I did was make the changes in the 3 files listed in message #17.

Then I changed the line Johan mentioned in bfa_rotating_header_images.php
from this:
$files = m_find_in_dir(get_option('upload_path'), 'atahualpa_header_[0-9]+\.(jpe?g|png|gif|bmp)$');
to this:
$files = m_find_in_dir(get_option('upload_path'), 'atahualpa/header_[0-9]+\.(jpe?g|png|gif|bmp)$');

I made a new folder named "atahualpa" for my test site, which is site number 2:

blogs.dir/
2
/files
atahualpa

In the new atahualpa folder, I put header_1.jpg, header_2.jpg, header_3.jpg, header_4.jpg

Didn't have to do anything else with the site or ATO. It just worked.

johanM Jul 21, 2010 05:19 PM

1 Attachment(s)
Quote:

ONLY the lines in "bfa_rotating_header_images.php" have to be changed as Johan described AND each <blog_id> has to have an /images folder where the headerimages have to be placed?
Hi, tsotsi, no and yes,

There is an issue that wp 3 default can only upload and read the files from blog_site_id/files, all files for multi-site enabled web and files must be under that 'files' directory

First, from Aubergine, there are 3 files will need to be modified, find them and search the lines

if (file_exists(ABSPATH."/wpmu-settings.php")), and replace or comment it out as I did, with

Code:

//    if (file_exists(ABSPATH."/wpmu-settings.php")) {
    if ( defined('WP_ALLOW_MULTISITE') ) {

after you finish editing all 3 files, you can start to upload the image files to the site directory, the wp3 upload default should be at

"path-to-web-directory/wp-content/blog.dir/<site_id>/files/" (see attached example)

Next, if you only made the change here without the changes similar to Aubergine did, you must name your image files with prefix as 'atahualpa_header_', for example, atahualpa_header_01.jpg, atahualpa_header_02.jpg.....etc.

if you want to mask the image directory and read the file from blog_url/images instead of 'files' directory, you could use rewrite rule in your .htaccess file, otherwise you can stop here and reload your web page.

tsotsi Jul 22, 2010 11:54 AM

Thanks Johan,

if I understand right what you are saying is that if I only change the lines in "bfa_rotating_header_images.php" I have to name the header picturers like "atahualpa_header_01.jpg" etc. but if I change the files Aubergine suggested as well, the name of the image files do not matter?? It just confuses me a bit.

Tsotsi

johanM Jul 22, 2010 01:55 PM

Hi tsotsi

The image prefix 'atahualpa_header_' was hard coded by ata default. I recall that Flynn had answered the similar question for someone you have here. Please search it.

If you want to use the method as Aubergine and I did, you need to create that sub-directory under the 'files' directory first and then upload the image with image prefix whatever you preferred or changed, whatever method you use, the name of image is similar as image-prefix_###.jpg, png, or gif. The image-prefix are either as default 'atahualpa_header_' or anything, the ### should be 1,2,3... or 01,02,03..., or 001, 002, 003......etc.

If this is still too technical for you, you might want to consider to go to Donor section and ask someone for help to do it for you.

wadams92101 Jul 27, 2010 11:30 AM

Great thread! Thanks Talynndar, Johan, Aubergine, Tsotsi!

gmarsh Oct 12, 2010 12:55 PM

Thanks for this thread, it helped me out a lot.

I wanted to add that this did not work for me:
Code:

if ( defined('WP_ALLOW_MULTISITE') ) {
but this did:
Code:

if ( is_multisite() ) {
I just edited the three files and that was it. I was also able to upload the correctly named images using the wordpress Media Library and they were picked up correctly.


All times are GMT -6. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.