Use meta data in html block
-
I have a bunch of HTML which is used to display the weather on my website. On each post, I would like the weather widget to be customized to the location of that post.
Each post has two meta_key:
main_point_latitude
main_point_longitudemeta_value is number is both cases.
The widget takes two arguements: data-lat and data-lng (see documentation https://windy.app/widgets)
Given that I need php to return these meta values, what else do I need to do here? I do not want to edit the main php files, but I’m happy to use something like code snippets, and use a shortcode.
Currently I have not been successful in using the shortcode via code snippets.
This is the php that i’ve been using in code snippets:
$lat = get_post_meta(get_the_ID(), 'main_point_latitude', true); $lng = get_post_meta(get_the_ID(), 'main_point_longitude', true);This is the rest of the code that I’ve been using in the html editor. I’m not sure how to complete the two missing arguements.
<div data-windywidget="forecast" data-thememode="white" data-tempunit="F" data-lat= data-lng= data-appid="0fea25fa5677b6078fede48527aa7fdf"> </div> <script async="true" data-cfasync="false" type="text/javascript" src="https://windy.app/widgets-code/forecast/windy_forecast_async.js?v1.3.91"></script>The page I need help with: [log in to see the link]
The topic ‘Use meta data in html block’ is closed to new replies.