Skip to content

Instantly share code, notes, and snippets.

@halgatewood halgatewood/awe_ajax.php
Last active Jan 14, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.