Best Weather Plugin for WordPress Premium Widget

Now you can show live weather updates on any of your websites without any problem because WeatherPlugin.co website provides you with an excellent and easy-to-use weather plugin. Through this, you can show the weather report of any city around the world in complete detail by using the name of any city in shortcode.

Demo Weather Widgets

Loading…

Premium Weather Plugin

In the premium plugin you just have to use the shortcode [ weather city=”delhi” country=”India”] and change only the city and country name. This shortcode can be easily used in any post or page of WordPress.

Free Weather Version

Step – 1. Using this code you can display weather information on any of your websites. Copy the code below and paste it into the custom HTML code in a post or page on your PHP website or WordPress website.

Step – 2. You just have to change the name of your city or any city and country in this line <div id=”weather-widget-2″ class=”weather-widget” data-city=”Delhi” data-country=”India”> and enter weather-widget-2 unique i.e. 1, 2, 3 like this

    <link rel="stylesheet" href="https://weatherplugin.co/wp-content/plugins/weather-plugin/styles.css">

    <div id="weather-widget-2" class="weather-widget" data-city="Delhi" data-country="India">
        <div class="weather-content">Loading...</div>
    </div>

    <script>
        function fetchWeather(widgetId) {
            var widget = document.getElementById(widgetId);
            var city = widget.getAttribute('data-city');
            var country = widget.getAttribute('data-country');
            var apiUrl = `https://weatherplugin.co/wp-json/weather-api/v1/weather/?city=${encodeURIComponent(city)}&country=${encodeURIComponent(country)}`;

            fetch(apiUrl)
                .then(response => response.json())
                .then(data => {
                    var weatherContent = '';
                    if (data && typeof data === 'string') {
                        weatherContent = data;
                    } else {
                        weatherContent = 'No weather data available.';
                    }
                    widget.querySelector('.weather-content').innerHTML = weatherContent;
                })
                .catch(error => {
                    console.error('Error fetching weather data:', error);
                    widget.querySelector('.weather-content').innerHTML = 'Error fetching weather data.';
                });
        }

        // Initialize weather widgets
        document.querySelectorAll('.weather-widget').forEach(function(widget) {
            fetchWeather(widget.id);
        });
    </script>

Plugin installation and setup

Our weather plugin is very easy to install and use, when you purchase this plugin you will be given a plugin to use. All you need to do is go to your WordPress site, click on Plugins section, click on Add New Plugin and upload the provided plugin from our website. And then it has to be activated.

After this [ weather city=”delhi” country=”India”] you will get a shortcode code like this, in this shortcode you only have to change the name of the city and country, then wherever you paste it, the weather information will be visible. It will start. In this way, you can show live weather updates in the posts, pages and widgets of your website by adding the name of any city and country around the world to the shortcode.

Plugin Documentation

The plugin displays weather information using the OpenWeatherMap API. In this, you can use the free API to show complete weather information for the next 7 days in detail. You do not need any additional settings or API to use this plugin. All you need to do is install the plugin and paste the mentioned shortcodes into the post or page. By doing this all the settings of the plugin will be completed and your plugin will be ready to use.

If you face any problem while using the plugin, you can mail us on this email [email protected], we will try to solve your problem quickly. Please read the Terms and Conditions carefully before making a purchase.