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.

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.