Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Wordpress中为注册成员显示不同的内容_Php_Wordpress_Templates_Themes - Fatal编程技术网

Php 在Wordpress中为注册成员显示不同的内容

Php 在Wordpress中为注册成员显示不同的内容,php,wordpress,templates,themes,Php,Wordpress,Templates,Themes,好的,我现在向所有访问我的WP站点的用户展示以下内容: <div class="gravatar"> <?php $user_id = get_current_user_id(); // Get the user ID $size_avatar = 50; // Set the avatar size $default_avatar = 'http://techyoucation.com/wp-content/themes/blank/images/avatar50.png';

好的,我现在向所有访问我的WP站点的用户展示以下内容:

<div class="gravatar">
<?php
$user_id = get_current_user_id(); // Get the user ID
$size_avatar = 50; // Set the avatar size
$default_avatar = 'http://techyoucation.com/wp-content/themes/blank/images/avatar50.png';        // Set your default image url
echo get_avatar( $user_id, $size_avatar, $default_avatar ); // This prints the <img> tag     with correct avatar image url
?>
</div>

现在,我希望这只显示给登录到我的网站的用户,并为没有登录的用户显示不同的内容,例如

<div class="Register">
<p>Register</p>
</div>

登记册

我该怎么做

提前谢谢


Aled

它有一个非常简单的功能:

<?php if (is_user_logged_in()): ?>
    You're logged in.    
<?php else: ?>
    <div class="Register">
    <p>Register</p>
    </div>
<?php endif; ?>

你已经登录了。
登记册