"Celsius", "weather_loc" => "Dubai", "humidity" => "", "country" => "on", "city" => "on", "wind" => "", "weather_icon" =>"on", "condition" =>"", "absw_element" => "div"); update_option('absw_plugin_options', $arr); } function abswoptions_init_fn(){ register_setting('absw_plugin_options', 'absw_plugin_options', 'absw_plugin_options_validate' ); add_settings_section('main_section', 'Usage & Settings', 'absw_section_text_fn', __FILE__); add_settings_field('weather_loc', 'Location (City or GPS coordinates)', 'absw_setting_string_fn', __FILE__, 'main_section'); add_settings_field('absw_weather_unit', 'Unit', 'absw_setting_dropdown_fn', __FILE__, 'main_section'); add_settings_field('absw_element', 'Container Element', 'absw_setting_element_fn', __FILE__, 'main_section'); add_settings_field('absw_weather_icon', 'Display Weather Icon', 'absw_setting_weather_icon_fn', __FILE__, 'main_section'); add_settings_field('absw_city', 'Display City/Region', 'absw_setting_city_fn', __FILE__, 'main_section'); add_settings_field('absw_country', 'Display Country Name', 'absw_setting_country_fn', __FILE__, 'main_section'); add_settings_field('absw_condition', 'Display Current Condition', 'absw_setting_condition_fn', __FILE__, 'main_section'); add_settings_field('absw_humidity', 'Display Humidity', 'absw_setting_humidity_fn', __FILE__, 'main_section'); add_settings_field('absw_wind', 'Display Wind', 'absw_setting_wind_fn', __FILE__, 'main_section'); } function absw_weather_assets() { wp_enqueue_style( 'abWeatherStyle', plugin_dir_url( __FILE__ ).'assets/css/abWeather.css', false ); wp_enqueue_script( 'abWeatherScript', plugin_dir_url( __FILE__ ).'assets/js/jquery.simpleWeather.min.js', 'jQuery', '', true ); } function enqueue_abswTiny_script($plugin_array){ $plugin_array["InsertWeather_button"] = plugin_dir_url(__FILE__) . "assets/js/abTiny.js"; return $plugin_array; } function register_absw_button_editor($buttons){ array_push($buttons, "InsertWeather"); return $buttons; } add_filter("mce_buttons", "register_absw_button_editor"); add_filter("mce_external_plugins", "enqueue_abswTiny_script"); add_action( 'wp_enqueue_scripts', 'absw_weather_assets' ); function absw_weather_script() { $options = get_option('absw_plugin_options'); ?> To display the weather in a page or post, add this shortcode to the content area: [abs-weather]

To display the weather in a template use this code: <?php if(function_exists('absWeather')) { echo absWeather(); } ?>

"; } function absw_setting_dropdown_fn() { $options = get_option('absw_plugin_options'); $items = array("Celsius", "Fahrenheit"); echo ""; } function absw_setting_element_fn() { $options = get_option('absw_plugin_options'); $items = array("h2", "h3", "div", "p", "span"); echo " Markup setting - decides how the weather to be displayed."; } function absw_setting_string_fn() { $options = get_option('absw_plugin_options'); echo " "; } function absw_setting_weather_icon_fn() { $options = get_option('absw_plugin_options'); isset($options['weather_icon'] ) && $options['weather_icon'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_setting_city_fn() { $options = get_option('absw_plugin_options'); isset($options['city'] ) && $options['city'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_setting_country_fn() { $options = get_option('absw_plugin_options'); isset($options['country'] ) && $options['country'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_setting_humidity_fn() { $options = get_option('absw_plugin_options'); isset($options['humidity'] ) && $options['humidity'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_setting_condition_fn() { $options = get_option('absw_plugin_options'); isset($options['condition'] ) && $options['condition'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_setting_wind_fn() { $options = get_option('absw_plugin_options'); isset($options['wind'] ) && $options['wind'] != '' ? $checked = ' checked="checked" ' : $checked =''; echo ""; } function absw_options_page_fn() { ?>

AB Simple Weather Settings

'; return $data; } add_shortcode('abs-weather','absWeather');