Title: php help please
Last modified: August 19, 2016

---

# php help please

 *  Resolved [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * (@carmeljune)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/)
 * There is a mistake in the 5th line (array), can someone correct it for me please?
   Could be others but that’s the feed back I’m getting.
 *     ```
       function kish_picture_page_no_sidebar() {
        global $post;
        $cats=get_the_category($post->ID);
        foreach($cats as $cat) {
        if( $cat_name(array("Birds", "Gardens", "Technology")) ) {
        {?>
        <style>
        #sidebars { display: none; border: none; }
        #container {width:940px}
        #content  {width:100%; background}
        #content_box { background:none; }
        #content_box img{max-width:850px;height:auto;}
        </style>
        <?php }
        }
        }
       }
       add_filter('thesis_hook_before_html', 'kish_picture_page_no_sidebar');
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649612)
 * I think this is what you want:
 *     ```
       if( in_array($cat->cat_name,array("Birds", "Gardens", "Technology")) ) {
       ```
   
 *  Thread Starter [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * (@carmeljune)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649754)
 * thanks vtxyzzy, this works now. Unfortunately it isn’t doing exactly what I wanted.
   I want the code to remove the sidebar on all of the category pages except the
   first one which is the home page. This code removes the sidebar from the 3 category
   pages, but I assume it is reading those names into the home page because it contains
   posts in those categories, and there fore removes its sidebar too.
 * Maybe the code has to say if the page contains only posts in these categories,
   than remove side bar.
 * Can someone translate that into php?
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649769)
 * Adding the is_category test will make the function effective only on the category
   pages:
 *     ```
       function kish_picture_page_no_sidebar() {
        global $post;
        if ( !is_category() ) return;
        $cats=get_the_category($post->ID);
       ```
   
 *  Thread Starter [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * (@carmeljune)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649793)
 * Thank you vtxyzzy, now I have complete control over the sidebar.
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649798)
 * You are welcome! Now, please use the dropdown at top right to mark this topic‘
   Resolved’.
 *  Thread Starter [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * (@carmeljune)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649800)
 * thank you, thought I had done that … it is such a satisfying thing to do!
 *  Thread Starter [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * (@carmeljune)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649801)
 * I had missed the ‘change’ button.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘php help please’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [carmeljune](https://wordpress.org/support/users/carmeljune/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/php-help-please-2/#post-1649801)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
