-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-hooks.php
40 lines (36 loc) · 1.21 KB
/
custom-hooks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// custom urls
add_filter('get_avatar_url', function ($url, $thing) {
$id = 0;
if (gettype($thing) == 'object') {
if (isset($thing->user_id)) {
$id = (int) $thing->user_id;
} else if (isset($thing->post_author)) {
$id = (int) $thing->post_author;
} else if (isset($thing->author)) {
$id = (int) $thing->author;
} else {
$id = (int) $thing->ID;
}
// } elseif (gettype($thing) == 'array') {
// if ($thing['user_id']) {
// $id = (int) $thing['user_id'];
// } else if ($thing['post_author']) {
// $id = (int) $thing['post_author'];
// } else if ($thing['author']) {
// $id = (int) $thing['author'];
// } else {
// $id = (int) $thing['ID'];
// }
} else {
$id = (int) $thing;
}
// $x = 2180 + ($id % 20);
// $y = 1420 + floor($id / 20);
// return 'https://stamen-tiles-a.a.ssl.fastly.net/toner-background/12/' . $x . '/' . $y . '@2x.png';
// higher zoom level
$x = 17424 + ($id % 20);
$y = 11365 + floor($id / 20);
// return 'https://stamen-tiles-b.a.ssl.fastly.net/toner-background/15/' . $x . '/' . $y . '@2x.png';
return 'https://tiles.stadiamaps.com/tiles/stamen-toner/15/' . $x . '/' . $y . '@2x.png';
}, 10, 2);