Title: if statement   div
Last modified: August 30, 2016

---

# if statement div

 *  Resolved [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/)
 * Hello,
    I have the following code running :
 *     ```
       <div class="site-info">
        <h6>Title</h6>
           <?php if (!is_user_logged_in()) {
           echo '<div style="display:'.((get_locale()=="fr_FR")?'block':'none').';" >'; multieditDisplay('FR-content'); echo '</div>';
           echo '<div style="display:'.((get_locale()!="fr_FR")?'block':'none').';" >'; multieditDisplay('EN-content'); echo '</div>';
           }
   
       if(!is_user_logged_in()) Rencontre::f_ficheLibre();
                               // version WIDGET
                           else if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-3')) : endif;
   
           ?>
           </div>
       ```
   
 * I’d like to have :
    if (!is_user_logged_in()) code as above.
 * if (!s_user_logged_in())
    code as above without the class=”site-info” and without
   the <h6>Title</h6>
 * I’ve been struggling with it and cannot make it work.
 * Thank you !

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

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487967)
 * Which theme are you working with? If you’re not using a theme distributed on 
   WordPress.org then I recommend contacting the theme’s authors/ vendors – because
   to us that theme is a black box
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487971)
 * I would try:
 *     ```
       $class = 'site-info';
       $title = '<h6>Title</h6>';
       if (!is_user_logged_in()) {
           $class = '';
           $title = '';
   
           //
       } else {
   
       }
       ?>
   
       <div class="site-info">
       <?php echo $title ?>
       ```
   
 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487977)
 * I’m using theme twentythirteen that I have modified a bit.
    Thanks for the code
   you went, I’ll try it and let you know !
 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487978)
 * Actually I don’t understand why there is no </div> and no <?php and where I am
   supposed to put these lines :
 *     ```
       echo '<div style="display:'.((get_locale()=="fr_FR")?'block':'none').';" >'; multieditDisplay('FR-content'); echo '</div>';
           echo '<div style="display:'.((get_locale()!="fr_FR")?'block':'none').';" >'; multieditDisplay('EN-content'); echo '</div>';
           }
   
       if(!is_user_logged_in()) Rencontre::f_ficheLibre();
   
       else if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-3')) : endif;
       ```
   
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487979)
 * Where did you get that code from?
 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487980)
 * I use the plugin “Rencontre”
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6487981)
 * What is that code doing, can you give more context on what you want to achieve?
 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6488001)
 * It’s showing the latest members on the page and I want them only to show up while
   the members are not connected.
 *  Thread Starter [lucilem](https://wordpress.org/support/users/lucilem/)
 * (@lucilem)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6488034)
 * I finally figured it out !
 *     ```
       <?php
       if (!is_user_logged_in()) {
       ?>
       <h6>TITLE</h6>
       <?php
        }
       ?>
   
       <?php
       $class = "site-info";
       if (is_user_logged_in()) {
       $class = "";
       }
       ?>
       	<div class="<?php print $class; ?>">
   
           <?php if (!is_user_logged_in()) {
           echo '<div style="display:'.((get_locale()=="fr_FR")?'block':'none').';" >'; multieditDisplay('FR-content'); echo '</div>';
           echo '<div style="display:'.((get_locale()!="fr_FR")?'block':'none').';" >'; multieditDisplay('EN-content'); echo '</div>';
           }
   
       if(!is_user_logged_in()) Rencontre::f_ficheLibre();
                               // version WIDGET
                           else if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-3')) : endif;
           ?>
           </div>
       ```
   

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

The topic ‘if statement div’ is closed to new replies.

## Tags

 * [div](https://wordpress.org/support/topic-tag/div/)
 * [if statement](https://wordpress.org/support/topic-tag/if-statement/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 2 participants
 * Last reply from: [lucilem](https://wordpress.org/support/users/lucilem/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/if-statement-div/#post-6488034)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
