Title: Help with some PHP code
Last modified: August 20, 2016

---

# Help with some PHP code

 *  [mikelacroix](https://wordpress.org/support/users/mikelacroix/)
 * (@mikelacroix)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php-code/)
 * Hello!
 * Could anyone tell me what I’m doing wrong here?
 *     ```
       <?php
       $user_id = get_current_user_id();
         if ( $user_id == 38 ) {
       echo'';
   
       } else {
       echo '<?php
       	$single = is_single();
           	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) :
           ?>
   
           <?php endif; ?>';
       }
       ?>
       ```
   
 * I’m trying to get the code to return the dynamic sidebar for all users except
   for user 38, who will get nothing returned. I keep getting errors in the ‘else’
   section. Any assistance would be remarkable!! 🙂

Viewing 1 replies (of 1 total)

 *  [Chris Fritz](https://wordpress.org/support/users/chrisvfritz/)
 * (@chrisvfritz)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php-code/#post-2833530)
 * If you’ve registered your sidebar in your functions.php file, try this code, 
   replacing SIDEBAR_NAME with whatever name you registered your sidebar with.
 *     ```
       <?php
       $user_id = get_current_user_id();
       if ( !($user_id == 38) ) {
       	dynamic_sidebar('SIDEBAR_NAME');
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Help with some PHP code’ is closed to new replies.

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Chris Fritz](https://wordpress.org/support/users/chrisvfritz/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php-code/#post-2833530)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
