menus - Change "loginregister" to "useraccount" when a user has logged in

I made a menu-button on my site's first page that show "loginregister". I want to change its name from &

I made a menu-button on my site's first page that show "login/register". I want to change its name from "login/register" to "user account" when a user has logged in.

I tried changing codes in global.css and layout.css, but it didn't work.

I made a menu-button on my site's first page that show "login/register". I want to change its name from "login/register" to "user account" when a user has logged in.

I tried changing codes in global.css and layout.css, but it didn't work.

Share Improve this question edited Dec 29, 2014 at 4:23 Mayeenul Islam 12.9k21 gold badges85 silver badges169 bronze badges asked Dec 28, 2014 at 20:39 SaeedSSaeedS 31 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I did a similar thing in many of my projects, here's how I did it:

<div class="user-panel">
    <ul>
        <?php
        if (is_user_logged_in() ) {
            // When the user is Logged-in
            $current_user= wp_get_current_user();
            echo '<li>'. __( 'Welcome, ', 'text-domain' ) .'<strong>'. $current_user->user_nicename .'</strong></li>';
            echo '<li><a href="'. wp_logout_url( home_url() ) .'" title="Log out">'. __( 'Log out', 'text-domain' ) .'</a></li>';
        }
        else
        {
            // When user is logged-out
            echo '<li><a href="'. wp_registration_url() .'" title="Register a New Account">'. __( 'Register', 'text-domain' ) .'</a></li>';
            echo '<li><a href="'. wp_login_url() .'" title="Login to the site">'. __( 'Login', 'text-domain' ) .'</a></li>';
        } ?>
    </ul>
</div>
<!-- /.user-panel -->

It's not a matter of CSS, it's a matter of Templating. After this, do the CSS to make it look better. :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745081520a4610154.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信