daily pastebin goal
13%
SHARE
TWEET

WordPress - Show message for logged-in users

lorro Mar 12th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // WordPress - Show message for logged-in users
  3. // usage: [user_message]
  4. add_shortcode( 'user_message', 'user_message' );
  5. function user_message() {
  6.   if ( is_user_logged_in() ) {
  7.     print '<p>My custom message for logged-in users.</p>'.PHP_EOL;
  8.   }
  9. }
  10.  
  11. // The code goes in functions.php for your child theme or you can use the "My Custom Functions" plugin.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top