Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] Making a new widget area (http://forum.bytesforall.com/showthread.php?t=2768)

xxxevilgrinxxx Aug 1, 2009 03:52 PM

[SOLVED] Making a new widget area
 
hello,

I'm running the latest Atahualpa version, 342, and was looking to play with adding some new widget areas.

I've got a test area set up to play with this:
http://foreverdyingbrightly.com/testblog/

added this to the content area of the 'footer' section in ATO:
Code:

<?php bfa_widget_area('name=footer widget&cells=2&align_1&align_2=2&width_1=150&width_2=300'); ?>
And I'm coming up with this in the footer area:
Code:

Fatal error: Call to undefined function: str_ireplace() in /home/forev26/public_html/testblog/wp-content/themes/atahualpa3/functions.php on line 321
what can I do to make this work?
*Once I know, I'll likely test it out in the header and content areas as well...I sense more questions just around the corner :D *

thx in advance,
Elaine:)

juggledad Aug 2, 2009 06:16 AM

If you have any plugins, please disable them all and see if the problem still exists
How have you gone about shutting off the left sidebar?

xxxevilgrinxxx Aug 2, 2009 07:28 AM

it's a bare bones test environment so I'm only running akismet, dolly, Page Navi and Series. Nope, no dice there, I'm still getting no widgety goodness.

Stranger still, str_ireplace() doesn't exist anywhere in the functions.php file :confused: I suppose that makes sense why it can't be found, but why is it looking? I even uploaded a clean copy of the functions.php file, to no avail. I'm stumped (I'm a somewhat regular-ish donator if that helps :D 'qwstnevrythg@gmail.com').

Maybe if someone's got a blog where there are extra widgets added so that I could have a look and maybe rummage through code to see what's gone wacky with mine? I'm not a genius but a fairly okay tinkerer.

As for the left sidebar, it technically still exists and shows up in my admin panel, I've just 'removed' it on the sidebar page in ATO.

thanks in advance for the help
Elaine:)

ps...just a weird random thought, is str_ireplace() a typo? I'm off to see if getting rid of that 'i' will blow anything up. Just have to find out where the 'i' is coming from. So far I've gone through most of the theme files and can't come across it, drat.

juggledad Aug 2, 2009 09:07 AM

Did you add a widget to the footer? I put in your code and it runs fine. I'll try adding a widget.

xxxevilgrinxxx Aug 2, 2009 09:21 AM

thanks, Juggledad.
In theory, I'm thinking that this should create a new widget area in my admin panel.
http://i32.photobucket.com/albums/d2...f/73662a6f.jpg
I have one 'blank' space, so I dropped a calendar in there for the heck of it. Still no good. Can you drop me a link where the new widget works so that I can have a look?

btw, it's good to know that the line of code works, that's one less thing to worry about :)

ETA:
I think it may be a typo(?)
in functions.php , in the custom widgets area:
Code:

function bfa_widget_area($args = '') {
        $defaults = array(
                'cells' => 3,
                'align' => 2,
                'before_widget' => '<div id="%1$s" class="widget %2$s">',
                'after_widget' => '</div>',
                'before_title' => '<div class="widget-title"><h3>',
                'after_title' => '</h3></div>',
        );
       
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );

        $area_id = strtolower(str_ireplace(" ", "_", $r['name']));


I went in and took out that 'i' in str_ireplace and at least my error message went away. I'll investigate further (boy, being dyslexic and looking for errors is fun! *snorks*)

excellent, now my new widget areas show up in the admin area as well, yay!
http://i32.photobucket.com/albums/d2...f/077d9438.jpg


the result is ugly but it was more about getting the thing to show up:
http://i32.photobucket.com/albums/d2...f/9ac4fe06.jpg
thanks!
Elaine:)

juggledad Aug 2, 2009 10:33 AM

str_ireplace is a PHP function (see http://www.w3schools.com/php/func_st...r_ireplace.asp) and I think it was added in version 5. Do you know what version of PHP are you running? I'll bet it is 4.x

several host providers default to version 4, but there are ways to have them switch to version 5.

One quick way to find out is to install wp-security-scan (http://wordpress.org/extend/plugins/wp-security-scan/) which dumps some system info on it's main page which will tell you the PHP version

xxxevilgrinxxx Aug 2, 2009 02:49 PM

thanks, I'm running PHP4 right now. Maybe when I get home I'll have to switch it to 5 to see if it does anything new for me but for the moment, changing that one letter seems to make all the difference between the two versions. Now I'll be playing around seeing what the two different functions do :) For a tinkerer, this is a lot of fun :D
I'm sure if I've experienced this, other people will have as well, so thanks for all the help, Juggledad! I'd say this one is closed :D
Elaine:)

juggledad Aug 2, 2009 03:47 PM

FYI - same problem, solution - PHP5 see http://forum.bytesforall.com/showthread.php?t=2747)


All times are GMT -6. The time now is 11:01 PM.

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