Advertisement
arie_cristianD

hide fake counter option except admin role

May 19th, 2025
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. function custom_admin_body_class( $classes ) {
  2.  
  3.     global $pagenow;
  4.     if ( $pagenow === 'post.php' || $pagenow === 'post-new.php' ) {
  5.         if ( current_user_can( 'manage_options' ) ) {
  6.             $classes .= ' admin-roles';
  7.         }
  8.     }
  9.  
  10.     return $classes;
  11. }
  12. add_filter( 'admin_body_class', 'custom_admin_body_class' );
  13.  
  14.  
  15. add_action(
  16.     'admin_print_styles',
  17.     function () {
  18.         ?>
  19.         <style type="text/css" id="customn-gutenberg-style">
  20.                 #jnews_section_jnews_override_counter {
  21.                     display:  none !important;;
  22.                 }
  23.  
  24.  
  25.                 .admin-roles #jnews_section_jnews_override_counter {
  26.                     display:  flex !important;;
  27.                 }
  28.         </style>
  29.         <?php
  30.     },
  31.     99
  32. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement