WordPress.org

Ready to get started?Download WordPress

Forums

Error with Freshy theme (13 posts)

  1. jag
    Member
    Posted 7 years ago #

    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

  2. jag
    Member
    Posted 7 years ago #

    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

  3. TimoK
    Member
    Posted 7 years ago #

    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.

  4. jag
    Member
    Posted 7 years ago #

    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

  5. 4k
    Member
    Posted 7 years ago #

    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.

  6. jag
    Member
    Posted 7 years ago #

    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

  7. 4k
    Member
    Posted 7 years ago #

    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

  8. jag
    Member
    Posted 7 years ago #

    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

  9. 4k
    Member
    Posted 7 years ago #

    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.

  10. jag
    Member
    Posted 7 years ago #

    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

  11. jag
    Member
    Posted 7 years ago #

    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

  12. nickfan
    Member
    Posted 7 years ago #

    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.

  13. Matt
    Member
    Posted 6 years ago #

    **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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.