Title: [welcome_message]?
Last modified: November 10, 2017

---

# [welcome_message]?

 *  [newspace](https://wordpress.org/support/users/newspace/)
 * (@newspace)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/welcome_message/)
 * Hello, I do not understand how to make it work, I use DIVI Builder. If I want
   this to appear on my home page, what is the short code I need to put in the page?
   This one: [welcome_message]?
    Here is my code:
 *  // Create a welcome message shortcode
    function d4tw_welcome_msg () { $current_user
   = wp_get_current_user(); //get the current user info if ( is_user_logged_in ()&&(
   $current_user->user_firstname ) ) { //this will run if user is logged in and 
   has a first name registered return ‘<p>Welcome back ‘ . $current_user->user_firstname.‘.
   Thank you for shopping!’; //return the message } elseif ( is_user_logged_in ()&&(!
   $current_user->user_firstname ) ) { //this will run if user is logged in with
   no first name registered return ‘<p>Welcome back ‘ . $current_user->nickname .‘.
   Thank you for shopping!’; //run the message } else { return ‘Welcome, guest! 
   Click [here](https://wordpress.org/my-account/?output_format=md) to create an
   account or login.’; //this will run for guest users } } add_shortcode(‘welcome_message’,‘
   d4tw_welcome_msg’);
 * Thank you for answer.
    -  This topic was modified 8 years, 7 months ago by [newspace](https://wordpress.org/support/users/newspace/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/welcome_message/#post-9705505)
 * Hi,
 * After adding this code to a new snippet, you should be able to insert the `[welcome_message]`
   shortcode into the content of your page, and it should display properly.

Viewing 1 replies (of 1 total)

The topic ‘[welcome_message]?’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/welcome_message/#post-9705505)
 * Status: not a support question