Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

[SOLVED] 3.6.7 PHP error when adding widget areas


  #1  
Old May 14, 2011, 06:24 AM
jakobsmith
 
32 posts · Feb 2010
Copenhagen
[SOLVED] 3.6.7 PHP error when adding widget areas

I'm having this problem with ATA 3.6.7:

I want to have a frontpage on the site with 3 widget areas (columns) in the center column area. Due to the recent changes to the theme, I'm adding this widget area code in index.php:

PHP Code:
    if (is_front_page()) {
    
bfa_widget_area('name=ForsideWidgets&cells=3&before_widget=<div id="%1$s" class="header-widget %2$s">&after_widget=</div>');
    } else {
    echo 
"";
    } 
The 3 widget areas appears on the front page, but above them I also get these errors, one for each widget area:

Warning: array_key_exists() expects parameter 2 to be array, string given in /var/www/(domain removed)/public_html/wp-content/themes/atahualpa367/functions.php on line 404

Warning: array_key_exists() expects parameter 2 to be array, string given in /var/www/(domain removed)/public_html/wp-content/themes/atahualpa367/functions.php on line 404

Warning: array_key_exists() expects parameter 2 to be array, string given in /var/www/(domain removed)/public_html/wp-content/themes/atahualpa367/functions.php on line 404

On line 403-407 in functions.php, I have:

PHP Code:
        // Check if any of the cells have a set width
        
for ( $i 1$i <= $r['cells']; $i++ ) { 
            if ( 
array_key_exists('width_' $i$args) AND !empty($args['width_' $i]) ) {
                    
$colgroup 'yes';
            }
        } 
Anyone knows what the problem is?

Server: Apache/2.2.17 (Unix) PHP/5.3.5
  #2  
Old May 14, 2011, 06:48 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
where in index.php did you add the code?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old May 14, 2011, 06:58 AM
jakobsmith
 
32 posts · Feb 2010
Copenhagen
I put it on lines 40-44.

I've used the same code with the Shortcode Exec PHP-plugin and got the same errors.

Guess I could remove the errors by turning off PHP error reporting, but that doesn't seem like a good solution.
  #4  
Old May 14, 2011, 07:33 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Try this, edit functions.php and change line 404 from
HTML Code:
			if ( array_key_exists('width_' . $i, $args) AND !empty($args['width_' . $i]) ) {
to
HTML Code:
			if ( array_key_exists('width_' . $i, $r) AND !empty($r['width_' . $i]) ) {
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old May 14, 2011, 08:18 AM
jakobsmith
 
32 posts · Feb 2010
Copenhagen
Quote:
Originally Posted by juggledad
Try this, edit functions.php and change line 404 from
HTML Code:
			if ( array_key_exists('width_' . $i, $args) AND !empty($args['width_' . $i]) ) {
to
HTML Code:
			if ( array_key_exists('width_' . $i, $r) AND !empty($r['width_' . $i]) ) {
It solved the problem. Thanks a lot

Bookmarks

Tags
3.6.7, functions.php, php errors, widget areas

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding multiple widget areas to header bodger Sidebars & Widgets 1 Feb 7, 2011 12:41 PM
Adding New Widget Areas & Position Widgets in Area Ogregeek Sidebars & Widgets 11 Jan 7, 2011 09:09 AM
[SOLVED] Adding Widget areas incorrectly? twomomsdesigns Sidebars & Widgets 3 Aug 20, 2010 08:30 AM
[SOLVED] Adding widget areas in the header joaodagraca Sidebars & Widgets 6 Aug 14, 2009 07:44 AM
adding new widget areas? dbweim Sidebars & Widgets 1 Aug 8, 2009 04:28 AM


All times are GMT -6. The time now is 11:34 AM.


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