Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Run custom inline CSS based on user id **/
- add_action( 'wp_head', 'run_my_custom_css');
- function run_my_custom_css() {
- global $current_user;
- $user_id = get_current_user_id();
- if( is_user_logged_in() && $user_id == '30'){
- ?>
- <style>
- .read-more {display: none;}
- </style>
- <?php
- }
- }
- /** Run custom inline JS based on user id **/
- add_action( 'wp_head', 'run_my_custom_javascript');
- function run_my_custom_javascript() {
- global $current_user;
- $user_id = get_current_user_id();
- if( is_user_logged_in() && $user_id == '1'){
- ?>
- <script>
- alert('This alert will only show for the admin (user_id: 1)');
- </script>
- <?php
- }
- }
Add Comment
Please, Sign In to add comment