Last active
January 14, 2019 21:38
-
-
Save halgatewood/bd3add0be01e4a3cde9365dddee55c1c to your computer and use it in GitHub Desktop.
Calling the Awesome Weather Widget through AJAX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hg_plugins_loaded() | |
{ | |
if( isset($_GET['weather_widget']) ) | |
{ | |
echo awesome_weather_logic( array('location' => 'Boston', 'owm_city_id' => 4930956, 'use_user_location' => true, 'background_by_weather' => true )); | |
die; | |
} | |
} | |
add_filter('plugins_loaded', 'hg_plugins_loaded', 100); | |
// HTML IN YOUR TEMPLATE | |
/* <div id="widget"><script>jQuery("#widget").load("<?php echo site_url(); ?>?weather_widget");</script></div> */ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment