Title: Syntax error on conditional
Last modified: August 19, 2016

---

# Syntax error on conditional

 *  [sazuka](https://wordpress.org/support/users/sazuka/)
 * (@sazuka)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-on-conditional/)
 * Hi, I am having problems since hours to get this to work.
 * I put this code in my sidebar.php but i only get errors.
    I hope someone knows
   a solution for this:
 *     ```
       <? if (is_home()) {
          query_posts($query_string . '&cat=74');
       }
   
       else if (is_single('1')){
          query_posts($query_string . '&cat=1')
       }
   
       else if (is_single('2')){
          query_posts($query_string . '&cat=2')
       }
   
       else {
          query_posts($query_string . '&cat=4')
       }
       ?>
       ```
   

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

 *  Thread Starter [sazuka](https://wordpress.org/support/users/sazuka/)
 * (@sazuka)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-on-conditional/#post-1575676)
 * I continued to work on it and now there is no error but it always jumps to the
   last else{ on main page.
 *     ```
       <? if (is_home() || is_front_page() ) {
          query_posts($query_string . '&cat=4');
       }
   
       else if (is_single('2466')){
          query_posts($query_string . '&cat=72');
       }
   
       else {
           query_posts($query_string . '&cat=4');
       }
       ?>
       ```
   
 *  Thread Starter [sazuka](https://wordpress.org/support/users/sazuka/)
 * (@sazuka)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-on-conditional/#post-1575703)
 * This doesnt work for me :/
 * <? if (is_home() || is_front_page()) {
 * It just skips this if clause whenever i try to refresh my home/front page

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

The topic ‘Syntax error on conditional’ is closed to new replies.

 * 2 replies
 * 1 participant
 * Last reply from: [sazuka](https://wordpress.org/support/users/sazuka/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/syntax-error-on-conditional/#post-1575703)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
