Как скрыть контактную информацию в WordPress
Как скрыть контактную информацию профиля в WordPress для посетителей с xxx в конце или просто скрыть ее?
<div class="profile-description lineheight25 margincenter mb10">
<div class="pt5 pb5 pl10 pr10">
<span class="border-grey-bottom blockstyle width-100p mb5 fontbold">
<?php esc_html_e( 'Contacts', 'rehub-theme' ); ?>
</span>
<p class="fontitalic font80">
<?php if ( isset( $store_address ) && !empty( $store_address ) ) { ?>
<i class="rhicon rhi-map-marker-alt"></i> <?php echo ''.$store_address; ?>
<?php } ?>
<?php if ( !empty( $store_user->get_phone() ) ) { ?>
<br />
<i class="rhicon rhi-mobile"></i>
<a href="tel:<?php echo esc_html( $store_user->get_phone() ); ?>">
<?php echo esc_html( $store_user->get_phone() ); ?>
</a>
<?php } ?>
<?php if ( $store_user->show_email() == 'yes' ) { ?>
<br />
<i class="rhicon rhi-envelope"></i>
<a href="mailto:<?php echo antispambot( $store_user->get_email() ); ?>">
<?php echo antispambot( $store_user->get_email() ); ?>
</a>
<?php } ?>
</p>
</div>
</div>
Ответы (1 шт):
Автор решения: Darth KYL
→ Ссылка
если вам нужно показывать этот блок только для авторизированных пользователей вы можете проверить его через функцию is_user_logged_in()
<?php if ( is_user_logged_in() ) : ?>
<div class="profile-description lineheight25 margincenter mb10">
<div class="pt5 pb5 pl10 pr10">
<span class="border-grey-bottom blockstyle width-100p mb5 fontbold">
<?php esc_html_e( 'Contacts', 'rehub-theme' ); ?>
</span>
<p class="fontitalic font80">
<?php if ( isset( $store_address ) && !empty( $store_address ) ) { ?>
<i class="rhicon rhi-map-marker-alt"></i> <?php echo ''.$store_address; ?>
<?php } ?>
<?php if ( !empty( $store_user->get_phone() ) ) { ?>
<br />
<i class="rhicon rhi-mobile"></i>
<a href="tel:<?php echo esc_html( $store_user->get_phone() ); ?>">
<?php echo esc_html( $store_user->get_phone() ); ?>
</a>
<?php } ?>
<?php if ( $store_user->show_email() == 'yes' ) { ?>
<br />
<i class="rhicon rhi-envelope"></i>
<a href="mailto:<?php echo antispambot( $store_user->get_email() ); ?>">
<?php echo antispambot( $store_user->get_email() ); ?>
</a>
<?php } ?>
</p>
</div>
</div>
<?php else : ?>
<a href="#"><?php _e( 'Please login or register to see this information' ); ?></a>
<?php endif; ?>