display some content in sidebar just for logged in users (2 posts)

  1. univende
    Posted 5 years ago #

    Hello, I´ve a problem trying to figure this out, if someone could help me, I´d really apreciate it.

    I want to display just some information in one block of my sidebar for logged in users and some to everyone.

    This is what I want to display to everyone:

  2. <span><?php _e('university:','cp');?></span> <?php echo get_the_author_meta('univeristy'); ?>
  3. And this is what I want just to display for logged in users:

  4. <span><?php _e('Cel:','cp');?></span> <?php echo get_the_author_meta('celphone'); ?>
  5. <span><?php _e('E-mail: ','cp')?></span><?php echo get_the_author_meta('user_email'); ?>
  6. So far I know I coul use this

    <blockquote><?php if (get_option('    DONT KNOW WHAT HERE') == 'yes' && is_user_logged_in()) {
                            include_once( DONT KNOW IF THIS IS RIGHT );
                        } elseif (get_option('DONT KNOW WHAT HERE TOO ') <> 'yes'){
                            include_once(DONT KNOW WHAT THIS CALL );
                        } else {
       <div class="pad25"></div>
                            <p class="contact_msg center"><strong><?php _e('You should be Looged in to see this information.', 'cp') ?></strong></p>
                            <div class="pad100"></div>
                  <?php } ?>


  • Peter_L
    Posted 5 years ago #

    Test this out

    <?php if (is_user_logged_in()) {//user is looged in ?>
        <span><?php _e('Cel:','cp'); ?></span>
        <?php echo get_the_author_meta('celphone'); ?>
    <span><?php _e('E-mail: ','cp'); ?></span><?php echo get_the_author_meta('user_email'); ?>
    <?php }else { // user is not logged in ?>
        <span><?php _e('university:','cp'); ?></span>
        <?php echo get_the_author_meta('univeristy'); ?>
  • Topic Closed

    This topic has been closed to new replies.

    About this Topic