• Resolved bwisecritic

    (@bwisecritic)


    The complete error is:

    Warning: Invalid argument supplied for foreach() in /home/content/87/4973087/html/wp-content/themes/NewsOne/index.php on line 26

    It’s occurring on my homepage: https://www.bobbywisecriticism.com.

    This featured window should be a slideshow, and is supposed to work like this that on the original demo: https://www.webdesignlessons.com/demo/.

    If anyone know how to fix this error, I’d greatly appreciate learning how to fix it. Thanks everyone!

    -bobby

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey Bobby,

    Can you post the code surrounding line 26 in your index.php file? Typically when you see this error, it means that the first argument passed in the foreach() function is bad. Most scenarios a person simply mistyped the variable name or forgot the $ symbol in front of the variable name. Before I can give you a better answer though, I need to see the code that is causing the problem first.

    Thread Starter bwisecritic

    (@bwisecritic)

    I really appreciate the response. Here are lines 21 through 27:

    Line 21
    <div id=”carousel_t1″>
    Line 22
    <div id=”carousel_t1_box”>
    Line 23
    <div id=”stepcarouse_tl”>
    Line 24
    <div class=”stepcarouse_belt_tl”>
    Line 25
    <?php $featured_post_count = obwp_get_meta(SHORTNAME.”_featured_post_count”,’int’,5); ?>
    Line 26
    <?php $carousel_posts = carousel_featured_posts($featured_post_count); $coint_i=0; foreach($carousel_posts as $carousel_post) { ?>
    Line 27
    <!– stepcarouse_tl_thumb –>

    Hey,

    Sorry for taking forever to get back to you on this. I want to assume you have solved this already, but just in case here is how I would try to troubleshoot it. Comment out the foreach and then echo out $carousel_posts using print_r($carousel_posts); If this prints out a properly formed array, then I do not know what is wrong.

    -Mike

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need help resolving “Warning: Invalid argument supplied for foreach() in” error’ is closed to new replies.