Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   New Versions, & Updating (http://forum.bytesforall.com/forumdisplay.php?f=12)
-   -   [SOLVED] 3.6.7 PHP error when adding widget areas (http://forum.bytesforall.com/showthread.php?t=14159)

jakobsmith May 14, 2011 06:24 AM

[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

juggledad May 14, 2011 06:48 AM

where in index.php did you add the code?

jakobsmith May 14, 2011 06:58 AM

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.

juggledad May 14, 2011 07:33 AM

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]) ) {

jakobsmith May 14, 2011 08:18 AM

Quote:

Originally Posted by juggledad (Post 65454)
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 :)


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

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