Wordpress Tips
WordPress Tip: Showing Dynamic Content Based on Weather
In the past few months, I have covered plenty of dynamic content plugins that let you display content based on various conditions, including date. Have you ever wanted to show weather related content dynamically. OpenWeather API can help. After you have signed and acquired your API key, you will be able to make calls to get the current weather based on visitor location:
Once there, you will have to come up with a function that processes the information and displays the dynamic content. In case no weather data is available, default content will be shown. In this case, we are just passing text content. You also have the option to pass HTML elements
For a more complex message, you can use a shortcode like this:
I have never had to use something like this but it is nice to have the option.
