• on certain pages there are these three lines indicating some sort of erroe

    Warning: Invalid argument supplied for foreach() in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 309

    Warning: array_slice() [function.array-slice]: The first argument should be an array in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 314

    Warning: Invalid argument supplied for foreach() in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 316

Viewing 14 replies - 1 through 14 (of 14 total)
  • I’d backup your existing header.php and grab an original header from the default WP theme and build your existing code back in.

    Thread Starter nappy155

    (@nappy155)

    that didn’t work..the thing is i never touched the header file…

    Can you find the offending code and post here to look at?

    Thread Starter nappy155

    (@nappy155)

    the code

    Warning: Invalid argument supplied for foreach() in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 309

    Warning: array_slice() [function.array-slice]: The first argument should be an array in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 314

    Warning: Invalid argument supplied for foreach() in /var/www/html/blog/wp-content/themes/arthemia-premium/header.php on line 316

    No, I mean the code from lines 309 to 316 in header.php that are causing the problem.

    Thread Starter nappy155

    (@nappy155)

    line 309: foreach ( $cp_categories as $b ) {

    line 316: $postcat = array_slice($postcat, 0, 5);

    line 316: foreach ($postcat as $cp_pC ) { ?>

    Please post a URL. “certain pages” what pages?

    The quick way around the problem would be to just test that those variables are arrays before they’re used like that:

    if(is_array($cp_categories))
    {
    foreach ( $cp_categories as $b ) {
    // ...code here...
    }
    }
    if(is_array($postcat))
    {
    $postcat = array_slice($postcat, 0, 5);
    }
    if(is_array($postcat))
    {
    foreach ($postcat as $cp_pC ) { ?>
    ...code here...
    }

    However, that’s just a workaround, better would be to rewrite the code elsewhere to ensure that those variables are always arrays.

    Thread Starter nappy155

    (@nappy155)

    I am very new to this..am i replacing the existing code with what you posted

    Okay, just be careful to make sure that the brackets align.

    Thread Starter nappy155

    (@nappy155)

    here’s one of the pages

    http://www.maddeep.com/blog/?cat=12

    The pages with errors all have the same errors which include open div’s.

    The normal way of clearing errors is to turn off all plugins and see if that helps. Also do a quick switch to the default theme to see if the error persists.

    In addition, I find it much easier to fix any errors when the code is correct. I think you should correct your code also.
    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.maddeep.com%2Fblog%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&verbose=1&user-agent=W3C_Validator%2F1.654

    Thread Starter nappy155

    (@nappy155)

    well it sees that the wp-shopping cart plug-in was the problem…are there any carts that are just as versatile….

    If you theme is Arthemia Premium – dont touch any code!

    You must make this:
    – created headline & featured cats
    – In athemia premium options assigned category bar and headlines /featured dropdowns

    Thats all.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘header.php’ is closed to new replies.