Skip to content

Instantly share code, notes, and snippets.

<?php
function time2str($ts) {
if(!ctype_digit($ts)) {
$ts = strtotime($ts);
}
$diff = time() - $ts;
if($diff == 0) {
return 'now';
} elseif($diff > 0) {
$day_diff = floor($diff / 86400);
// hide edit with elementor for editor
add_action('wp_head', 'allteams_custom_styles', 100);
function allteams_custom_styles() {
$user = wp_get_current_user();
if ( in_array( 'editor', (array) $user->roles ) && !is_admin() ) {
echo "<style>#wp-admin-bar-elementor_edit_page{display: none !important;}</style>";
}
}