Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

WordPress - Show message for logged-in users

lorro Mar 12th, 2017 79 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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