内部动态侧边栏if(is_user_logged_in()){echo''; } else {

时间:2015-10-02 22:48:31

标签: php wordpress

我想在访客访问网站时在我的div中显示动态侧边栏。有什么想法吗?

    <?php
if ( is_user_logged_in() ) {
    echo '';
} else {
    echo '<div class="slideraanmeldbuiten">
<div class="slideraanmeldbinnen">
<div class="slideraanmeld">
<div class="slideraanmeldinside">

<?php 
 // Custom widget Area Start
 if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Zoektermen 1') ) : ?>
<?php endif;
// Custom widget Area End
?>

</div>
</div></div></div>';
};
?>

2 个答案:

答案 0 :(得分:0)

<?php
if ( is_user_logged_in() ) {
    echo '';
} else {
    echo '<div class="slideraanmeldbuiten">
<div class="slideraanmeldbinnen">
<div class="slideraanmeld">
<div class="slideraanmeldinside">

<?php 
 // Custom widget Area Start
 if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Zoektermen 1') ) : ?>
<?php endif;
// Custom widget Area End
?>
<?php
'</div>
</div></div></div>';
};
?>

控制你关闭它的php标签,而不是打开最后一个标签。你也忘记了&#39;标签

答案 1 :(得分:0)

这样做自己:

<?php if( is_home() || is_front_page() ) : ?>
    <?php if ( !is_user_logged_in() ) : ?>
<div class="slideraanmeldbuiten">
<div class="slideraanmeldbinnen">
<div class="slideraanmeld">
<div class="slideraanmeldinside">

<?php if( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Aanmeldvak') ) : ?>
<?php endif; ?>


</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>