Я добавил пользовательскую перчатую, которая выглядит так, как это /match match_id%/. Мой собственный короткометражный код [match_id] , который работает, но я не могу добавить его в существующий шорт-код в качестве числа (например, [FP-predictions Text = "No Data" match = [match_id]].
Код: Выделить всё
function get_match_id_from_url() {
global $wp;
$current_url = home_url(add_query_arg(array(), $wp->request));
$parts = explode('/', $current_url);
$match_id = end($parts);
return $match_id;
}
function display_match_id_shortcode() {
$match_id = get_match_id_from_url();
return $match_id;
}
add_shortcode('match_id', 'display_match_id_shortcode');
Подробнее здесь: https://stackoverflow.com/questions/794 ... -wordpress
Мобильная версия