$categories = get_categories(array(
'orderby' => 'count',
'order' => 'DESC',
'hide_empty' => true
));
$counts = wp_list_pluck($categories, 'count');
$max_count = max($counts);
$min_count = min($counts);
$count_range = ($max_count - $min_count) ? ($max_count - $min_count) : 1;
$normalized = ($category->count - $min_count) / $count_range;
$font_size = 14 + round($normalized * 10, 2);
const response = await fetch(_fg_object.ajax_url, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest" // Важно для WordPress
},
body: JSON.stringify({
action: "ajax_get_taxonomies",
nonce_code: _fg_object.getTaxAJAX_nonce,
data: {
username: "JohnDoe",
message: "Hello from fetch!"
}
}),
});
fetch( url, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache'
}),
credentials: 'same-origin',
body: new URLSearchParams({
action: 'ty_questgo',
}),
}).then(response => response.json())
.then(response => console.log(response))
.catch(err => console.log(err));