Skip to content

Instantly share code, notes, and snippets.

@halgatewood
Last active January 14, 2019 21:38
Show Gist options
  • Save halgatewood/bd3add0be01e4a3cde9365dddee55c1c to your computer and use it in GitHub Desktop.
Save halgatewood/bd3add0be01e4a3cde9365dddee55c1c to your computer and use it in GitHub Desktop.
Calling the Awesome Weather Widget through AJAX.
<?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