Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Multisite (http://forum.bytesforall.com/forumdisplay.php?f=46)
-   -   [SOLVED] Rotating Header and individual logos on multisite install with Atahualpa 3.7 (http://forum.bytesforall.com/showthread.php?t=19547)

Codeman79 Feb 3, 2013 03:49 PM

[SOLVED] Rotating Header and individual logos on multisite install with Atahualpa 3.7
 
Hi,

I've been banging my head now for a couple of hours, and still didn't figure it out.

I am trying to implement a multisite network in a local test environment on Mac using Mamp. The goal is to get a multisite network working using Wordpress and Atahualpa only. For this reason I've been trying to implement the fixes and patches as shown here
http://forum.bytesforall.com/showthread.php?t=14544
and in other posts of LANtait.
Unfortunately none of them worked so far. I am not even sure, they work with the ATA 3.7.10?

Does anyone have a suggestion how to solve this issue?

I like the Atahualpa theme, kind of got used to it's features and actually don't want to start over learning a new theme, if I don't have to.

Thanks for your advice.
Regards,

Cody

Codeman79 Feb 13, 2013 12:46 PM

Hi,

spending some time trial&error-coding, I finally figured it out.

Maybe you folks from the ATA team might want to include this in the next update, since it only changes the multisite functionality.

I went ahead and replaced in Functions/bfa_rotating_header_images.php this:

PHP Code:

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

        
################### images in WP upload folder (on WPMU)
        
        
$files bfa_m_find_in_dir(get_option('upload_path'),
            
'atahualpa_header_[0-9]+\.(jpe?g|png|gif|bmp)$');

        if (
$files) {
            foreach(
$files as $value) {
                
$bfa_header_images[] = "'" str_replace(get_option('upload_path'),
                
get_option('fileupload_url'), $value) . "'"
            } 
        }

    } 

with that:

PHP Code:

    if (is_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)
      
                        
$home home_url();                         
                
                        
$files "";
                        
$imgpath ABSPATH get_option('upload_path').'/header/';

                        
$imgdir $home get_option('upload_path').'/header/';

                        
$dh  opendir($imgpath);

                        while (
FALSE !== ($filename readdir($dh))) {
                                if( 
preg_match('/\.jpg/i'$filename) || preg_match('/\.gif/i'$filename) || preg_match('/\.png/i'$filename) ) {
                        
$files[] = $filename;
                        }
                        
                        }

                        if(isset(
$bfa_ata['header_image_sort_or_shuffle'])) {
                                if (
$bfa_ata['header_image_sort_or_shuffle'] == "Sort") {
                                        
sort($files); } 
                                else { 
                                        
shuffle($files); }
                        }

                        
closedir($dh);

                        foreach(
$files as $value) {
                                
$bfa_header_images[] = '\'' $imgdir $value '\'';
                        }

                } 

In addition for each site I...

1. created a directory of folders in wp-content with this structure: blogs.dir/your site/files/header
2. set the upload path for the site in the super admin backend ->sites->edit->settings to
wp-content/blogs-dir/your site/files/
If your structure is somthing like mainsite/subsite, then you just place this instead of "your site".

Now you have separate locations for the header images of each site with rotation in place.

Oh, and regarding the individual logos, in bfa_header_config.php I just deleted this:

PHP Code:

if ( file_exists(ABSPATH."/wpmu-settings.php") ) 
                {
                    
// two ways to figure out the upload path on WPMU, first try easy     version 1, :
                    
$upload_path1 ABSPATH get_option('upload_path');
                    
                    
// Try the hard way, version 2: 
                    
$upload_path2 str_replace('themes/' get_option('stylesheet') . 
                    
'/functions'''$_SERVER['DOCUMENT_ROOT']) . 
                    
'/wp-content/blogs.dir/' $wpdb->blogid '/files';
                    
                    
// see if user has uploaded his own "logosymbol.gif" somewhere into his upload folder, version 1:
                    
$wpmu_logosymbol bfa_m_find_in_dir($upload_path1,$bfa_ata['logo']); $upload_path $upload_path1;
                    
                    
// try version 2 if no logosymbol.gif was found:
                    
if ( !$wpmu_logosymbol 
                        
$wpmu_logosymbol bfa_m_find_in_dir($upload_path2,$bfa_ata['logo']); $upload_path $upload_path2;
                    
                    
// if we found logosymbol.gif one way or another, figure out the public URL
                    
if ( $wpmu_logosymbol 
                    {
                        
$new_logosymbol str_replace($upload_path,
                        
get_option('fileupload_url'), $wpmu_logosymbol); 
                        echo 
$new_logosymbol[0] . '" alt="'bloginfo('name');
                    } 
                    
                    
// otherwise: print the one in the theme folder
                    
else 
                    { 
                        echo 
$templateURI '/images/' $bfa_ata['logo'] . 
                        
'" alt="'bloginfo('name'); 
                    }
                } 

and the else and brackets here

PHP Code:

                       else 
                { 
                    echo 
$templateURI '/images/' $bfa_ata['logo'] . '" alt="';
                    
bloginfo('name'); 
                } 

..., and use the original images folder of the main theme to store the logos.

It works!

Regards,

Cody


All times are GMT -6. The time now is 01:19 AM.

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