Title: header.php
Last modified: August 19, 2016

---

# header.php

 *  [nappy155](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/)
 * 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)

 *  [thelastknight](https://wordpress.org/support/users/thelastknight/)
 * (@thelastknight)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032639)
 * 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](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032643)
 * that didn’t work..the thing is i never touched the header file…
 *  [sojweb](https://wordpress.org/support/users/sojweb/)
 * (@sojweb)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032661)
 * Can you find the offending code and post here to look at?
 *  Thread Starter [nappy155](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032663)
 * 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
 *  [sojweb](https://wordpress.org/support/users/sojweb/)
 * (@sojweb)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032666)
 * No, I mean the code from lines 309 to 316 in `header.php` that are causing the
   problem.
 *  Thread Starter [nappy155](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032674)
 * line 309: foreach ( $cp_categories as $b ) {
 * line 316: $postcat = array_slice($postcat, 0, 5);
 * line 316: foreach ($postcat as $cp_pC ) { ?>
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032680)
 * Please post a URL. “certain pages” what pages?
 *  [sojweb](https://wordpress.org/support/users/sojweb/)
 * (@sojweb)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032681)
 * 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](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032686)
 * I am very new to this..am i replacing the existing code with what you posted
 *  [sojweb](https://wordpress.org/support/users/sojweb/)
 * (@sojweb)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032690)
 * Okay, just be careful to make sure that the brackets align.
 *  Thread Starter [nappy155](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032692)
 * here’s one of the pages
 * [http://www.maddeep.com/blog/?cat=12](http://www.maddeep.com/blog/?cat=12)
 *  [kmessinger](https://wordpress.org/support/users/kmessinger/)
 * (@kmessinger)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032700)
 * 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](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](https://wordpress.org/support/users/nappy155/)
 * (@nappy155)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/headerphp-5/#post-1032706)
 * well it sees that the wp-shopping cart plug-in was the problem…are there any 
   carts that are just as versatile….
 *  [100kotoff](https://wordpress.org/support/users/100kotoff/)
 * (@100kotoff)
 * [17 years ago](https://wordpress.org/support/topic/headerphp-5/#post-1032906)
 * 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.

## Tags

 * [header.php](https://wordpress.org/support/topic-tag/header-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 5 participants
 * Last reply from: [100kotoff](https://wordpress.org/support/users/100kotoff/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/headerphp-5/#post-1032906)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
