• Resolved lucilem

    (@lucilem)


    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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which theme are you working with? If you’re not using a theme distributed on www.remarpro.com then I recommend contacting the theme’s authors/ vendors – because to us that theme is a black box

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    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

    (@lucilem)

    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

    (@lucilem)

    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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Where did you get that code from?

    Thread Starter lucilem

    (@lucilem)

    I use the plugin “Rencontre”

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is that code doing, can you give more context on what you want to achieve?

    Thread Starter lucilem

    (@lucilem)

    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

    (@lucilem)

    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.