Login / Logout / Register / Account Dynamic Display

I’m using text element to display a login, logout, account and register link at the top bar of my website, I’ve done this by using an old code I found from 2016 located here: https://theme.co/archive/forums/topic/loginlogoutregisteraccount-in-top-bar/

First I’d like to know is the text element best to use for this application or should I use Headline or Button element?

Second, I’m not sure if since 2016 there is now a better way of doing this?

Third, I’m trying to use this code in the element CSS to make the buttons appear if logged in or appear if logged out:

Login / Register

.wp-account-url { display: block; }
.logged-in .wp-account-url { display: none; }

Logout / Account

.wp-account-url { display: none; }
.logged-in .wp-account-url { display: block; }

But the code isn’t performing correctly. Did I understand the code incorrectly?

I’ve figured out the problem for number 3, here is solution for anyone in the future who needs this code / functionality.

The problem is they were all using the same class so here is the css for each of the links:

Login
.wp-login-url { display: block; }
.logged-in .wp-login-url { display: none; }

Register
.wp-register-url { display: block; }
.logged-in .wp-register-url { display: none; }

Account
.wp-account-url { display: none; }
.logged-in .wp-account-url { display: block; }

Log Out
.wp-logout-url { display: none; }
.logged-in .wp-logout-url { display: block; }

However, I’d still like answers for the first two questions.

Hey Daniel,

Since what was suggested is just HTML links, it’s best to use a Button Element.

image

Insert the href value in the Button Element’s URL field.

image

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.