Add Personal Welcome Message For Logged In Members

This PHP code enables you to display a personal message to logged in members and a generic message to all non logged in members.

message

Please copy ALL the code from the view raw link in the Gist and paste it at the end of your child themes functions.php file using a text editor like Notepad++

About The Code

The above code includes the wp_head hook which executes at the top of the page and can be changed to any theme specific or WordPress hook position like loop_start or genesis_before_content.

The code uses the is_user_logged_in() conditional tag to check if the current user is logged in.

It also includes the wp_get_current_user() function to get the current user info which in the above code example is the first name.

On top of this, i’ve added a div with an existing class which you can change from entry-title to a new or existing class of your own.

The message displayed for non logged in members is not personalized.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.