• Resolved Haslepi

    (@haslepi)


    I need some help with this error message, I now get on my wordpress site.

    Error message below:

    Warning: Invalid argument supplied for foreach() in /home/.x.x.x.x./public_html/wp-content/themes/deco_fleximag/functions.php on line 19

    website is: https://www.carolinawoodfurniture.com

    Some Code from the function page is below: I have separated line 19 in the middle of the code so it would stand out for review..

    // load theme options page
    if (file_exists(TEMPLATEPATH.’/includes/theme-options.php’))
    include(TEMPLATEPATH.”/includes/theme-options.php”);
    // load some more goodies
    if (file_exists(TEMPLATEPATH.’/includes/core-additions.php’))
    include(TEMPLATEPATH.”/includes/core-additions.php”);
    // load footer widget function
    if (file_exists(TEMPLATEPATH.’/includes/footer-functions.php’))
    include(TEMPLATEPATH.”/includes/footer-functions.php”);
    // load anything in teh custom_functions folder

    foreach (glob(TEMPLATEPATH.”/includes/custom_functions/*.php”) as
    $filename) { include $filename; };

    // load custom background function if option set
    if(tt_option(‘cust_back’) == ‘Yes’) { add_custom_background(); }
    // load custom header function if option set
    if(tt_option(‘cust_header’) == ‘Yes’) { include(TEMPLATEPATH.”/includes/cust_header.php”); }
    // load function for FAQ page template

    Thanks in advance for any help..

    I only have 2 plugins on the site and I disabled them but that did not help ..

    Greg

Viewing 2 replies - 1 through 2 (of 2 total)
  • adiant

    (@adiant)

    Since the error occurs in your Deco Fleximag Theme, you should probably contact the Theme author for assistance.

    Since that Theme is not in the WordPress Theme Directory, you should try the author’s web site: [moderator edit: link to website removed due to breach of WordPress trademark policy]

    Assuming, of course, that this is your theme: https://freelancewp.com/wordpress-theme/deco_fleximag/

    Thread Starter Haslepi

    (@haslepi)

    I was told this:

    The glob() function returns false if there is an error, and that would cause foreach to give that error. It’s possible that the TEMPLATEPATH constant isn’t defined for some reason, or the “includes/custom_functions” directory doesn’t exist there. If neither of those things are the problem, it’s also possible that the user that PHP scripts runs under isn’t able to read from the directory due to filesystem permissions.

    This is how I fixed the problem:
    I just changed line to this:

    //foreach (glob(TEMPLATEPATH.”/includes/custom_functions/*.php”) as
    $filename) { include $filename; };

    so it would not call that particular function and the site works perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Warning: Invalid argument supplied for foreach()’ is closed to new replies.