Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » New Versions, & Updating »

The code needed to customize location of header images


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Feb 3, 2013, 07:08 PM
geir
 
2 posts · Jan 2012
I have to agree with a lot of the arguments put forth by noel.odesk in the now closed thread Why I Hate Upgrading Atahualpa.
Now, php is not my native language, but from what I can see, these are the code changes needed to introduce a theme option for specifying the location of the header image files. This will allow the header images to be put in a directory that survives a theme upgrade. Incorporating these few lines of code into an otherwise excellent theme would make life a little bit easier for quite a few of the ATA users out there.

File: functions/bfa_theme_options.php
Code:
(...)
                        common today, so the images should be that wide or wider. The next common screen widths are 1440, 1600, 1680 and
                        1920 pixels. </li></ul>" . $header_image_text),

+     array(    "name" => "Header Images Directory",
+             "category" => "header-image",
+             "id" => "header_images_dir",
+             "std" => "images/header",
+             "type" => "text",
+             "info" => "Directory for header image(s), relative to Atahualpa theme directory. No leading or trailing slashes."),
+
     array(    "name" => "Rotate header images with Javascript?",
            "category" => "header-image",
             "id" => "header_image_javascript",
(...)
File: functions/bfa_get_options.php
Code:
(...)
                        "allow_debug",
                        "IEDocType",
+                       "header_images_dir",
                        "overlay_header_image"
                        );
(...)
File: functions/bfa_rotating_header_images.php
Code:
(...)
                ################### images in /images/header/ (on regular WordPress)

                $files = "";
-               $imgpath = get_template_directory() . '/images/header/';
-               $imgdir = $templateURI . '/images/header/';
+                if(isset($bfa_ata['header_images_dir'])) {
+                        $imgpath = get_template_directory() . '/' . $bfa_ata['header_images_dir'] . '/';
+                        $imgdir =  $templateURI . '/' . $bfa_ata['header_images_dir'] . '/';
+                } else {
+                        $imgpath = get_template_directory() . '/images/header/';
+                        $imgdir = $templateURI . '/images/header/';
+                }
                $dh  = opendir($imgpath);

                while (FALSE !== ($filename = readdir($dh))) {
(...)
  #2  
Old Feb 4, 2013, 10:02 AM
juggledad's Avatar
juggledad
 
22,245 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
I spoke to Flynn and he thinks this will fly. I tested it and came up with a nice feature. If you use
'../../dirname' then you can put 'dirname' in the wp-contents folder and never worry that it might get removed during an update.

I'll be putting the code together along with the two 3.7.10 patches and giving it to Flynn for submission to WordPress.

Nice work, Ive been wanting to put something like this in pointing outside the theme directory, but by putting it in teh theme directory and using the '../../dirname' you can actually have the image directory outside the theme folder, the best of both worlds!!!
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Feb 4, 2013, 05:56 PM
geir
 
2 posts · Jan 2012
Quote:
Originally Posted by juggledad
I spoke to Flynn and he thinks this will fly. I tested it and came up with a nice feature. If you use
'../../dirname' then you can put 'dirname' in the wp-contents folder and never worry that it might get removed during an update.
Exactly. And I'm sure there are plugins out there (recommendations, anyone?) that let you control your media folder structure in such a way that those who want to avoid ftp altogether can point to a directory within their media library.

Quote:
I'll be putting the code together along with the two 3.7.10 patches and giving it to Flynn for submission to WordPress.
Sounds good.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to customize the location of image directory flyboy Header configuration & styling 1 Jul 2, 2011 11:51 AM
[SOLVED] Widget Areas Needed to run adsense code in header? webgurl Sidebars & Widgets 3 Dec 4, 2010 02:56 PM
Location for php code for SOCIABLE widget? strangelove Post-Kicker, -Byline & -Footer 1 Feb 18, 2009 06:04 PM


All times are GMT -6. The time now is 04:03 AM.


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