Display Specific Content for Admin Only in WordPress can be done easily, all need to do just write some if else statement with same parameter. On this example I will show you how to display simple stats from WordPress and display it in front page. Like on our previous WordPress tricks, we need to tweak on theme files, on this tricks we will play around with footer.php, it’s because I want display this information on the footer area.
<?php global $user_ID; if( $user_ID ) : ?> <?php if( current_user_can('level_10') ) : ?> <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> <?php endif; ?> <?php endif; ?>
On Display Content for Admin Only code above what we have done is checked if current user logging has level_10, if the user have this level, the content will be displayed. if the user below or didn’t logging, nothing to displayed. It’s easy right? You can explore this tricks and add more expert featured