Created
May 4, 2023 06:54
-
-
Save annuman97/ce685ca463a15e55cb6b4d0435b63314 to your computer and use it in GitHub Desktop.
Replace Numbers to Star in ninja table column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('ninja_tables_get_public_data', function ($data, $tableId) { | |
if ($tableId == 3156) { | |
for($i = 0; $i < count($data); $i++){ | |
$val = $data[$i]['player_ranking']; | |
$arr = []; | |
$icon = '[nt_icon icon="star" color="orange"]'; | |
for($j = 1; $j<= $val; $j++){ | |
array_push($arr, $icon); | |
} | |
$data[$i]['player_ranking'] = implode(" ", $arr);; | |
} | |
} | |
return $data; | |
}, 15, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment