hi friends i use wordpress but when in active yoo theme its show error but i don't know about this error please help
error show
Code:
Warning: Invalid argument supplied for foreach() in /public_html/wp-content/themes/yoo_catalyst/warp/systems/wordpress.3.0/helpers/widgets.php on line 107
It's telling you that on that line, $ids is not an array. As to why not, that would take some debugging to find out the call to wp_get_sidebars_widgets() is actually returning -- my guess is that it's returning Boolean false. You could try to debug with something like:
PHP Code:
public function getWidgets($position = null) {
if (empty($this->widgets)) { $sideBarWidgets = wp_get_sidebar_widgets(); foreach ($sideBarWidgets as $pos => $ids) { if( ! is_array($ids)) { die("<pre>Not an array:\n".var_export($sideBarWidgets, true)."</pre>"); } $this->widgets[$pos] = array(); foreach ($ids as $id) { $this->widgets[$pos][$id] = $this->get($id); } } }
Or you could try contacting the theme creator, or see if there is a new version of the theme.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Fatal error: Call to undefined function wp_get_sidebar_widgets() in /home/semdr786/public_html/wp-content/themes/yoo_catalyst/warp/systems/wordpress.3.0/helpers/widgets.php on line 105
That's because I made a typo, and "sidebars" should be plural.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
So, it looks like some elements are arrays and some are simple scalars with NULL values. I'm hesitant to suggest a final solution, since I don't really know what all this is supposed to do, nor how critical it is, but the simple solution to avoid the error might be something like:
PHP Code:
public function getWidgets($position = null) {
if (empty($this->widgets)) { $sideBarWidgets = wp_get_sidebar_widgets(); foreach ($sideBarWidgets as $pos => $ids) { if( ! is_array($ids)) { continue; // just skip this item } $this->widgets[$pos] = array(); foreach ($ids as $id) { $this->widgets[$pos][$id] = $this->get($id); } } }
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks