Below, you’ll find a detailed guide on how to add the Corona Virus Data Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Corona Virus Data Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Corona Virus Data Plugin and the shortcodes it provides:
"Corona Virus Data is a robust WordPress plugin that provides real-time updates and statistics about the COVID-19 pandemic globally. Stay informed and safe with accurate data at your fingertips."
- [cov2019]
- [cov2019contry]
- [cov2019all]
- [cov2019map]
- [cov2019history]
- [cov2019historyc]
- [cov2019namerica]
- [cov2019samerica]
- [cov2019europe]
- [cov2019asia]
- [cov2019oceania]
- [cov2019africa]
Corona Virus Data [cov2019] Shortcode
The Corona Virus Data shortcode is designed to display real-time global COVID-19 statistics. This shortcode fetches data such as total cases, deaths, recoveries, active cases, and critical cases. It also provides daily updates on cases and deaths, and the number of affected countries. The data is presented in a clear, easy-to-read format, making it a valuable tool for any website.
Shortcode: [cov2019]
Examples and Usage
Basic example – Display global corona virus data on your website
[cov2019 /]
The above shortcode will display global corona virus data including total cases, deaths, recovered, active cases, cases today, deaths today, critical cases, and affected countries. The data is updated in real-time.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019", "cov_func");
Shortcode PHP function:
function cov_func($atts, $content = null, $shortcodename = "")
{
wp_enqueue_style( 'corona-virus-data' );
$cov_country_n = __(get_option('cov__settings')['cov__select_field_0'],'corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('Global Total', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-total-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-total-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-total-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-total-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-total-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-total-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-total-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5><small>' . __('Affected Countries', 'corona-virus-data') . '</small></h5><h3 id="cov-total-affected-countries" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div><div class="clear"></div>';
$return .= '</div>';
wp_enqueue_script('corona-virus-data');
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019contry] Shortcode
The “corona-virus-data” plugin’s shortcode, “cov2019contry”, displays live COVID-19 data for a selected country. It retrieves and presents information such as total cases, deaths, recoveries, active cases, today’s cases and deaths, critical cases, and cases per million.
Shortcode: [cov2019contry]
Examples and Usage
Basic example – Displaying the corona virus data for a specific country using the shortcode.
[cov2019contry country="USA" /]
Advanced examples
Displaying the corona virus data for a specific country and customizing the displayed text using the shortcode.
[cov2019contry country="USA" case_text="Total Cases" death_text="Total Deaths" /]
Using the shortcode to display the corona virus data for a specific country, customizing the displayed text, and specifying the text color.
[cov2019contry country="USA" case_text="Total Cases" death_text="Total Deaths" text_color="#000000" /]
Please note that the above examples assume the presence of ‘country’, ‘case_text’, ‘death_text’, and ‘text_color’ attributes in the ‘cov_cty_func’ function. If these attributes are not available, you would need to modify the function to handle these attributes.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019contry]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019contry", "cov_cty_func");
Shortcode PHP function:
function cov_cty_func($atts, $content = null, $shortcodename = "")
{
wp_enqueue_style( 'corona-virus-data' );
$cov_country_n = __(get_option('cov__settings')['cov__select_field_0'],'corona-virus-data');
$return = '<div class="ncov2019"><div class="title text-center"><span id="cov_flag"></span>' . sprintf(__('Total in %s', 'corona-virus-data'), $cov_country_n) . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-country"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-new-confirm" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-new-dead"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-new-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5><small>' . __('Cases Per Million', 'corona-virus-data') . '</small></h5><h3 id="cov-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div><div class="clear"></div></div>';
wp_enqueue_script('corona-virus-data');
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019all] Shortcode
The “cov2019all” shortcode from the Corona Virus Data plugin displays a sortable table of global COVID-19 data. It enlists data by country or region, showing confirmed cases, deaths, and recoveries.
Shortcode: [cov2019all]
Examples and Usage
Basic example – A simple usage of the “cov2019all” shortcode to display the corona virus data table.
[cov2019all /]
Advanced examples
Utilizing the “cov2019all” shortcode with additional parameters to customize the display of the corona virus data table. In the following examples, we are assuming that the shortcode accepts parameters for “country” to filter data for a specific country and “sort” to sort the data based on confirmed cases, deaths, or recovered cases.
Display data for a specific country:
[cov2019all country="USA" /]
Sort data by the number of deaths:
[cov2019all sort="deaths" /]
Display data for a specific country and sort by the number of recovered cases:
[cov2019all country="Italy" sort="recovered" /]
Please note that these examples assume that the “cov2019all” shortcode accepts “country” and “sort” parameters. To use these parameters, you would need to modify the “cov_all_func” function to accept and process these parameters. If the function does not currently accept these parameters, these examples will not work as intended.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019all]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019all", "cov_all_func");
Shortcode PHP function:
function cov_all_func($atts, $content = null, $shortcodename = "")
{
if (!is_admin()) {
wp_enqueue_script('json2html');
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
}
$return = '<div class="ncov2019"><p>' . __('Sort by confirmed numbers.', 'corona-virus-data') . '</p><div id="cov_table_container"><table id="cov_all_table"><tbody><tr><th>' . __('Country or Region', 'corona-virus-data') . '</th><th>' . __('Cases', 'corona-virus-data') . '</th><th>' . __('Deaths', 'corona-virus-data') . '</b></th><th>' . __('Recovered', 'corona-virus-data') . '</th></tr></tbody></table><i class="cov-loading3"></i></div></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019map] Shortcode
The Corona Virus Data shortcode is a tool that enables the display of a dynamic COVID-19 map on your website. The shortcode calls the cov_map_func function, which enqueues necessary styles and scripts, including ‘corona-virus-data’, ‘leaflet’, and ‘cov_load_map’. It then returns a div containing the map, providing real-time data on the pandemic.
Shortcode: [cov2019map]
Examples and Usage
Basic example – The shortcode below will add a map to your page, which will display the latest corona virus data. The map will be styled and scripted according to the ‘corona-virus-data’ and ‘leaflet’ styles and scripts.
[cov2019map /]
For advanced examples:
In the advanced usage of the shortcode, we can pass parameters or attributes to modify the functionality or display of the map. However, based on the given PHP function ‘cov_map_func’, it does not accept any parameters. Thus, we cannot provide an advanced example with parameters. If you want to extend the functionality of this shortcode, you need to modify the PHP function to accept parameters.
For example, if you modify the ‘cov_map_func’ to accept a ‘size’ parameter, you can then use the shortcode like this:
[cov2019map size="large" /]
In this example, the ‘size’ parameter would control the size of the map on the page. Please note that this is just an example and would require additional coding in your PHP function to work.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019map]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019map", "cov_map_func");
Shortcode PHP function:
function cov_map_func($atts, $content = null, $shortcodename = "")
{
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
wp_enqueue_style('leaflet');
wp_enqueue_script('leaflet');
wp_enqueue_script('cov_load_map');
$return = '<div class="ncov2019"><i class="cov-loading4"></i><div id="cov__map" class="cov_map"></div></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019history] Shortcode
The Corona Virus Data shortcode is designed to fetch and display historical COVID-19 data. It calls relevant scripts and styles, then generates a line chart with the data. The function ‘cov_hist_all_func’ enqueues the necessary scripts and styles. It then creates a div element where the chart will be displayed. The JavaScript code inside the function fetches the historical data from an API, formats it, and displays it as a line chart. This shortcode offers a dynamic way to visually represent the progression of COVID-19 cases and deaths. Shortcode: [cov2019history]
Shortcode: [cov2019history]
Examples and Usage
Basic example – Displaying the historical data of COVID-19 globally using the shortcode
[cov2019history /]
For more advanced usage of the shortcode, you can consider passing different attributes to the shortcode. However, the given function doesn’t accept any attributes. Thus, you can’t pass any parameters to it.
If you want to pass parameters, you need to modify the function to accept parameters. Here’s an example of how you could modify the function to accept a ‘days’ parameter that specifies how many days of historical data to display:
“`php
function cov_hist_all_func($atts, $content = null, $shortcodename = “”)
{
wp_enqueue_style(‘corona-virus-data’);
wp_enqueue_script(‘corona-virus-data’);
wp_enqueue_script(‘chart.js’);
wp_enqueue_script(‘chartjs-utils’);
$atts = shortcode_atts(
array(
‘days’ => ‘all’
), $atts, $shortcodename
);
$days = $atts[‘days’];
// Rest of your code here, using $days variable to modify the API URL
}
“`
With this modification, you can use the shortcode like this:
Advanced example – Displaying the historical data of COVID-19 globally for the last 30 days
[cov2019history days="30" /]
Please note that the API URL in the function also needs to be updated to use the $days variable instead of ‘all’.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019history]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019history", "cov_hist_all_func");
Shortcode PHP function:
function cov_hist_all_func($atts, $content = null, $shortcodename = "")
{
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
wp_enqueue_script('chart.js');
wp_enqueue_script('chartjs-utils');
$return = '<div class="ncov2019"><div class="cov_chart_wrapper"><i class="cov-loading2"></i><canvas id="cov_hs_all" class="cov"></canvas></div>' ;
$return .= "<script>var getJSON=function(url,type){type=type||'get';return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest();xhr.open(type,url,true);xhr.responseType='json';xhr.onload=function(){var status=xhr.status;if(status==200){resolve(xhr.response)}else{reject(status)}};xhr.send()})};getJSON('https://disease.sh/v3/covid-19/historical/all?lastdays=all').then(function(data){var config={type:'line',data:{labels:Object.keys(data.cases),datasets:[{label:cov__cases,backgroundColor:window.chartColors.red,borderColor:window.chartColors.red,data:Object.values(data.cases),fill:false,},{label:cov__deaths,fill:false,backgroundColor:window.chartColors.gray,borderColor:window.chartColors.gray,data:Object.values(data.deaths),}]},options:{responsive:true,devicePixelRatio:4,elements:{line:{borderWidth:4},point:{radius:4,hoverRadius:8}},title:{display:true,text:cov__history_global,fontSize:30,},legend:{display:true,labels:{fontSize:12,padding:20,}},tooltips:{mode:'index',intersect:false,titleFontSize:20,},tooltipFontSize:20,hover:{mode:'nearest',intersect:true},scales:{x:{display:true,ticks:{fontSize:14}},y:{display:true,ticks:{fontSize:14}}},maintainAspectRatio:false}};var ctx=document.getElementById('cov_hs_all').getContext('2d');window.myLine=new Chart(ctx,config)},function(status){console.log(status)});</script></div>";
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019historyc] Shortcode
The Corona Virus Data shortcode is designed to display a line chart of historical Covid-19 data. It fetches data from an external API, then plots the number of cases and deaths over time. The PHP function ‘cov_hist_c_func’ enqueues necessary scripts and styles, and returns a div with a canvas element for the chart. It also includes a script that makes an AJAX request to the API, processes the response, and generates the chart.
Shortcode: [cov2019historyc]
Examples and Usage
Basic example – A simple usage of the shortcode without any attributes. This will display the default corona virus data chart.
[cov2019historyc /]
Advanced examples
Displaying the corona virus data chart for a specific country. In this example, the ‘country’ attribute is used to specify the country for which the data is to be displayed. The country name should be written in lowercase and spaces should be replaced with hyphens.
[cov2019historyc country="united-states" /]
Displaying the corona virus data chart with specific colors for cases and deaths. The ‘casesColor’ and ‘deathsColor’ attributes can be used to specify the colors. The color values should be valid CSS color values.
[cov2019historyc casesColor="red" deathsColor="gray" /]
Combining multiple attributes. In this example, the chart is displayed for a specific country and with specific colors for cases and deaths.
[cov2019historyc country="united-states" casesColor="red" deathsColor="gray" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019historyc]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019historyc", "cov_hist_c_func");
Shortcode PHP function:
function cov_hist_c_func($atts, $content = null, $shortcodename = "")
{
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
wp_enqueue_script('chart.js');
wp_enqueue_script('chartjs-utils');
$return = '<div class="ncov2019"><div class="cov_chart_wrapper"><i class="cov-loading2"></i><canvas id="cov_hs_c" class="cov"></canvas></div>' ;
$return .= "<script>var getJSON=function(url,type){type=type||'get';return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest();xhr.open(type,url,true);xhr.responseType='json';xhr.onload=function(){var status=xhr.status;if(status==200){resolve(xhr.response)}else{reject(status)}};xhr.send()})};getJSON('https://disease.sh/v3/covid-19/historical/'+cov__contry).then(function(data){var config={type:'line',data:{labels:Object.keys(data.timeline.cases),datasets:[{label:cov__cases,backgroundColor:window.chartColors.red,borderColor:window.chartColors.red,data:Object.values(data.timeline.cases),fill:false,},{label:cov__deaths,fill:false,backgroundColor:window.chartColors.gray,borderColor:window.chartColors.gray,data:Object.values(data.timeline.deaths),}]},options:{responsive:true,devicePixelRatio:4,elements:{line:{borderWidth:4},point:{radius:4,hoverRadius:8}},title:{display:true,text:cov__contry_text+' '+cov__history_c,fontSize:30,},legend:{display:true,labels:{fontSize:12,padding:20,}},tooltips:{mode:'index',intersect:false,titleFontSize:20,},tooltipFontSize:20,hover:{mode:'nearest',intersect:true},scales:{x:{display:true,ticks:{fontSize:14}},y:{display:true,ticks:{fontSize:14}}},maintainAspectRatio:false}};var ctx=document.getElementById('cov_hs_c').getContext('2d');window.myLine=new Chart(ctx,config)},function(status){console.log(status)});</script></div>";
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019namerica] Shortcode
The Corona Virus Data shortcode displays real-time COVID-19 data for North America. It fetches updates on cases, deaths, recoveries, active cases, and more.
Shortcode: [cov2019namerica]
Examples and Usage
Basic example – Displaying the North America Corona Virus data using the shortcode.
[cov2019namerica /]
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019namerica]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019namerica", "cov_n_america");
Shortcode PHP function:
function cov_n_america($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('North America', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-na"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-na-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-na-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-na-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-na-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-na-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-na-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-na-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-na-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019samerica] Shortcode
The Corona Virus Data plugin’s shortcode, “cov2019samerica”, displays a detailed COVID-19 data panel for South America. It enqueues necessary styles and scripts, then generates a section with statistics like cases, deaths, recoveries, active cases, cases today, deaths today, critical cases, and cases per million. The data is updated in real-time, providing the latest information.
Shortcode: [cov2019samerica]
Examples and Usage
Basic example – The basic usage of the cov2019samerica shortcode doesn’t require any parameters to be passed. It will display the latest COVID-19 data for South America.
[cov2019samerica /]
Advanced examples
While the given shortcode doesn’t support parameters, you can create variations of the shortcode to support different parameters. Here is an example of a modified shortcode that can take parameters to display COVID-19 data for different regions.
Suppose we have a modified shortcode “cov2019region”. This shortcode can take a region parameter to display COVID-19 data for the specified region.
[cov2019region region="Europe" /]
Another example of an advanced usage of the shortcode could be to display data for multiple regions. Suppose we have a modified shortcode “cov2019multi” which can take multiple region parameters.
[cov2019multi region1="Europe" region2="Asia" /]
Please note that these advanced examples would require modifications to the original PHP code of the shortcode in order to accept and process the parameters.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019samerica]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019samerica", "cov_s_america");
Shortcode PHP function:
function cov_s_america($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('South America', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-sa"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-sa-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-sa-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-sa-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-sa-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-sa-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-sa-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-sa-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-sa-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019europe] Shortcode
The Corona Virus Data shortcode provides real-time COVID-19 statistics for Europe. It fetches and displays data such as cases, deaths, recoveries, active cases, today’s cases and deaths, critical cases, and cases per million.
Shortcode: [cov2019europe]
Examples and Usage
Basic example – Displays corona virus data related to Europe.
[cov2019europe]
Advanced examples
Displaying the corona virus data with additional style and script parameters. These parameters allow for customization of the visual presentation and interaction of the data.
[cov2019europe style="corona-virus-data" script="corona-virus-data"]
Using the shortcode to display the corona virus data with a specified update time. This ensures that the data displayed is always up-to-date and accurate.
[cov2019europe time="cov-time-eu"]
Displaying the corona virus data with a focus on specific aspects such as cases, deaths, recovered, active cases, cases today, deaths today, critical cases, and cases per million. This allows for a more detailed and focused presentation of the data.
[cov2019europe cases="cov-eu-cases" deaths="cov-eu-dead" recovered="cov-eu-recoverd" active="cov-eu-active" cases_today="cov-eu-today-case" deaths_today="cov-eu-today-deaths" critical="cov-eu-critical" cases_per_million="cov-eu-case-million"]
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019europe]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019europe", "cov_europe");
Shortcode PHP function:
function cov_europe($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('Europe', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-eu"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-eu-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-eu-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-eu-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-eu-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-eu-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-eu-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-eu-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-eu-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019asia] Shortcode
The “cov2019asia” shortcode from the Corona Virus Data plugin is designed to display a comprehensive COVID-19 data dashboard for Asia. This includes the total cases, deaths, recoveries, active cases, cases today, deaths today, critical cases, and cases per million. The data is updated in real-time, ensuring accuracy and timeliness.
Shortcode: [cov2019asia]
Examples and Usage
Basic example – Displaying the most recent COVID-19 data for Asia
[cov2019asia /]
Here, the shortcode [cov2019asia /] is used without any additional parameters or attributes. This will display the most recent COVID-19 data for Asia on your WordPress site, including the number of cases, deaths, recoveries, and active cases. It also includes the number of cases today, deaths today, critical cases, and cases per million.
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019asia]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019asia", "cov_asia");
Shortcode PHP function:
function cov_asia($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('Asia', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-as"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-as-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-as-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-as-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-as-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-as-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-as-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-as-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-as-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019oceania] Shortcode
The Corona Virus Data shortcode displays COVID-19 statistics for Oceania. It enqueues the necessary style and script, then generates a div section showcasing the latest data. The data includes cases, deaths, recoveries, active cases, today’s cases and deaths, critical cases, and cases per million.
Shortcode: [cov2019oceania]
Examples and Usage
Basic example – Displaying the general corona virus data for Oceania on your website.
[cov2019oceania /]
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019oceania]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019oceania", "cov_oceania");
Shortcode PHP function:
function cov_oceania($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('Oceania', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-oa"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-oa-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-oa-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-oa-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-oa-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-oa-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-oa-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-oa-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-oa-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Corona Virus Data [cov2019africa] Shortcode
The Corona Virus Data shortcode, “cov2019africa”, displays up-to-date COVID-19 statistics for Africa. Upon execution, it enqueues the necessary style and script, then generates a styled HTML block. This block presents data like cases, deaths, recoveries, active cases, and more. The data is dynamically updated, providing real-time information.
Shortcode: [cov2019africa]
Examples and Usage
Basic example – Displays the latest COVID-19 data for Africa.
[cov2019africa /]
PHP Function Code
In case you have difficulties debugging what causing issues with [cov2019africa]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode("cov2019africa", "cov_africa");
Shortcode PHP function:
function cov_africa($atts, $content = null, $shortcodename = ""){
wp_enqueue_style( 'corona-virus-data' );
wp_enqueue_script('corona-virus-data');
$return = '<div class="ncov2019">
<div class="title text-center">' . __('Africa', 'corona-virus-data') . '</div>
<div>' . __('Last update on: ', 'corona-virus-data') . '<span id="cov-time-af"></span></div>
<div class="one_half text-center"><h5>' . __('Cases', 'corona-virus-data') . '</h5><h3 id="cov-af-cases" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths', 'corona-virus-data') . '</h5><h3 id="cov-af-dead"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Recovered', 'corona-virus-data') . '</h5><h3 id="cov-af-recoverd" class="has-text-color has-vivid-green-cyan-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Active', 'corona-virus-data') . '</h5><h3 id="cov-af-active" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading1"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Today', 'corona-virus-data') . '</h5><h3 id="cov-af-today-case" class="has-text-color has-luminous-vivid-orange-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Deaths Today', 'corona-virus-data') . '</h5><h3 id="cov-af-today-deaths"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Critical', 'corona-virus-data') . '</h5><h3 id="cov-af-critical" class="has-text-color has-vivid-red-color"><i class="cov-loading2"></i></h3></div>
<div class="one_half text-center"><h5>' . __('Cases Per Million', 'corona-virus-data') . '</h5><h3 id="cov-af-case-million" class="has-text-color has-vivid-cyan-blue-color"><i class="cov-loading2"></i></h3></div>
</div><div class="clear"></div>';
return $return;
}
Code file location:
corona-virus-data/corona-virus-data/includes/class-corona-virus-data.php
Conclusion
Now that you’ve learned how to embed the Corona Virus Data Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply