Для тех, кто знает HTML, это должно быть легко, но я новичок, так что это кажется практически невозможным.У меня есть шорткод календаря событий, который использует атрибут расстояние / радиус, чтобы показать события в 25 милях от определенного места.Все, что я хочу сделать, это сделать эти 25 миль выбранной пользователем переменной по ряду причин.Я подумал, что лучший / самый красивый способ - это ползунок диапазона с кнопкой отправки, но я не могу понять, как заставить весь этот код работать.
Мой код, который находится в functions.php:
function calendar_with_latlng_function( $atts ){
// Handle default values and extract them to variables
extract( shortcode_atts( array(
'near_distance' => 25,
), $atts, 'calendar_with_latlng' ) );
// Need something here so that the slider communicates to change the
// default 25. Again, don't really know what I'm doing here, but I hope
// I'm headed in the right direction at least. Most of this code I got
// from various internet sources.
// Get the current latlng from the gmw shortcode
$gmw_current_latlng = do_shortcode( '[gmw_current_latlng]' );
// Drop that value into the fullcalendar shortcode, and add the default (or passed) distance as well.
return do_shortcode( '[fullcalendar near='. $gmw_current_latlng .' near_distance='. $near_distance .']' );
И код, который у меня есть на странице.Я не уверен, является ли это даже способом сделать это, но я пробовал много вариантов этого:
<form action="" method="GET">
<input type="range" min="1" max="100" value="25" id="foo"
name="distance" onchange='document.getElementById("bar").value =
"Distance (miles): 25" + document.getElementById("foo").value;'/>
<input type="text" name="bar" id="bar" value="Distance (miles): 25"
disabled />
<br />
<input type=submit value=Submit />
</form>
Пожалуйста, дайте мне знать, что я могу сделать, чтобы достичь этого.Спасибо