WordPress.org

Support

Warning

  • Hi there,
    I am using plugin 0.7-beta4 on WP 3.5.

    I get the following error on a menu widget which uses “Current page’s top parent” as starting menu:

    Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/wp-content/plugins/gecka-submenu/models/NavMenuHacks.php on line 94

    I fixed this by myself, hacking the plugin source code, by adding a check like if (is_array($items)), but I hope it will be fixed in next releases.

    Thank you!

    http://wordpress.org/extend/plugins/gecka-submenu/

Viewing 6 replies - 1 through 6 (of 6 total)
  • P.s. there was a similar problem also around line 65:

    Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/wp-content/plugins/gecka-submenu/models/NavMenuHacks.php on line 65

    Marco,

    I have the same issues on line 94 & 65.

    I am new with php. Can you explain how/where to add this code?

    I have added… if (is_array($items)) …. at line 64, then took out and tried 66, then replaced 65 with it and nothin.. lol..
    Don’t laugh, just throwing darts..

    Thanks..

    Bryan

    Line 94 solve with: if (is_array($items)) foreach($items as $item) {

    Line 65 continue the problem: if (is_array($items)) foreach($posts as $key=>$post) {

    have you any idea to solve it?

    Thanks!

    Here’s the code to fix the issue:

    1. File NavMenuHacks.php on line 65.

    Change
    foreach($posts as $key=>$post) {
    to
    if (is_array($posts)) foreach($posts as $key=>$post) {

    2. File NavMenuHacks.php on line 94.

    Change
    foreach($items as $item) {
    to
    if (is_array($items)) foreach($items as $item) {

    Note: the array names are different in the two cases.

    Yeeeeeeah, thanks you very much Marco… now work well.

    Thank you very much Marco, this solves it for me.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Warning’ is closed to new replies.
Skip to toolbar