• Hi,

    Yesterday, my database mysteriously disappeared, and I had to restore it.

    However upon doing so, this error originating from my WordPress Freshy theme came out:

    Warning: Invalid argument supplied for foreach() in /home/jag82/public_html/wp-content/themes/freshy/functions.php on line 298

    Now I can’t even logged into my WP Admin.

    Will any kind souls be helpful enough to render me some assistance.

    Thanks a lot!

    Best Rgds,
    Jag

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter jag

    (@jag)

    Hi guys,

    Anyone has any solution for this? With this error, I cannot even log into WP admin.

    Any help is really much appreciated!

    Best Rgds,
    Jag

    Well, if it is really a theme problem deleting your themes folder (/home/jag82/public_html/wp-content/themes/freshy/) should solve it. If that doesn’t help then maybe your database restore did not work correctly.

    Thread Starter jag

    (@jag)

    Hi Timok,

    Thanks a lot for your reply. Is there any way where I can solve this without deleting this theme? Cos this theme was working fine before my database got messed up.

    I tried repairing my database a few times, but it doesn’t help.

    Are you familiar with the freshy theme?

    Thanks!

    Jag

    Some customizations you make with the freshy theme work directly upon the database.

    Since you changed the database that could be causing the errors.

    Could be as simple as uninstalling checking to see if all is ok, and then reinstalling the theme.

    Thread Starter jag

    (@jag)

    Hi guys,

    Thanks for the input.

    Anyway someone at the Freshy site suggestted uncommenting that declaration of foreach in the functions.php file.

    I’m not a programmer, so what does it mean by uncommenting the declaration of foreach?

    Thanks.

    Jag

    Open your freshy file, find the functions.php, open with notebook, look for this /* and then this */ take them both out, save reupload that file, refresh your site, see if it worked

    Thread Starter jag

    (@jag)

    4K,

    There are quite a few of such /* and */ in the file.

    Do I take out the one nearest to line 298 where the error is happening?

    Jag

    I see a comment at 292 and I don’t see the close till 411.

    If you do that make sure you save a backup first.

    You might also want to confirm with the theme author that those are the ones to remove.

    Thread Starter jag

    (@jag)

    Hi 411,

    Unfortunately that didn’t work!

    Try uninstalling and installing the theme again, but it didn’t work too!

    Sigh, I really love this theme, and I did so much customization to it prior to this unfortunate event.

    Thanks anyway 411 for your help! It is really much appreciated!

    Rgds.
    Jag

    Thread Starter jag

    (@jag)

    Anyone else willing to give this problem a shot?

    This error will only go away if I switch to another theme.

    Hopefully that is the last resort as I really like the freshy theme a lot. Have done a lot of customization to it.

    W be really thankful to anyone who has met this error before who can help me with this.

    Jag

    find the reason:
    $freshy_updated_options = $_POST;
    it will save your submit button value to the options in database,and it may cause an unserialize error.

    to fix this bug:

    open the function.php and find this line:
    $freshy_updated_options = $_POST;
    add this line next to it:

    unset($freshy_updated_options[‘Submit’]);

    save & reupload it ,then update your freshy themes options again ,or delete the freshy options from database if you known how to.

    **TAKE NOTE**
    Once you do this, you will need to go into the Freshy Theme Options and set your options again. Before you start, you should check what your settings are and copy them down.

    Now, if you really want this theme to work, this is what you need to do:

    Around line 283, you will see this block:

    /*
    
    	if (get_option('freshy_options')) {
    		$freshy_options = get_option('freshy_options');
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    	*/
    	if (get_option('freshy_options')) {
    		$existing_options = get_option('freshy_options');
    		foreach ($freshy_theme_default as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    		foreach ($existing_options as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}

    Change that to this:

    if (get_option('freshy_options')) {
    		$freshy_options = get_option('freshy_options');
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    
    	/*
    	if (get_option('freshy_options')) {
    		$existing_options = get_option('freshy_options');
    		foreach ($freshy_theme_default as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    		foreach ($existing_options as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    	*/

    Basically, you are uncommenting out the first “if” statement and commenting out the second “if” statement.

    **TAKE NOTE**
    Now, go back into the Freshy Theme Options and set everything back up how you want it. That should fix it; at least it did for me with my update to WordPress 2.2.2

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Error with Freshy theme’ is closed to new replies.