开发者 | cliffpaulick |
---|---|
更新时间 | 2020年12月22日 02:58 |
PHP版本: | 5.6 及以上 |
WordPress版本: | 5.6 |
版权: | GPL version 3 or any later version |
版权网址: | 版权信息 |
[tk_event_weather]
shortcode for use anywhere on your site (not just for your site calendar's event-specific information) so its usage is very flexible as long as there is a valid weather API key, latitude, longitude, and time (timestamp or ISO 8601 format)[tk_event_weather]
[tk_event_weather lat_long="38.897676,-77.03653" start_time="2016-02-01T16:30:00-05:00" end_time="2016-02-01T21:45:00-05:00"]
B) or separate shortcode arguments for Latitude and Longitude
[tk_event_weather lat="38.897676" long="-77.03653" start_time="2016-02-01T16:30:00-05:00" end_time="2016-02-01T21:45:00-05:00"]
C) or with Unix timestamps
[tk_event_weather lat_long="38.897676,-77.03653" start_time="1454362200" end_time="1454381100"]
D) Just like Example A but with Location shortcode argument (a Place name) -- available since version 1.2.0
[tk_event_weather location="The White House" start_time="1454362200" end_time="1454381100"]
E) Just like Example D but with Location shortcode argument (a full address) -- available since version 1.2.0
[tk_event_weather location="1600 Pennsylvania Ave NW, Washington, DC 20500, USA" start_time="1454362200" end_time="1454381100"]
F) Displaying more than one day in a sequence (multiple API calls but appear all together), like this screenshot
[tk_event_weather lat_long='28.5549259,-81.3342398' start_time='2016-08-27T22:00:00-04:00' end_time='2016-08-27T23:59:00-04:00' class='tkeventw-myclass'] [tk_event_weather lat_long='28.5549259,-81.3342398' start_time='2016-08-28T00:00:00-04:00' end_time='2016-08-28T04:30:00-04:00' class='tkeventw-myclass' darksky_credit_link_off='true']
And then add some custom CSS, like this:
.tkeventw-myclass { display: inline-block; vertical-align: top; }
G) To display from 4:30pm through the remainder of the day (do not set the end_time)
[tk_event_weather lat_long="38.897676,-77.03653" start_time="2016-02-01T16:30:00-05:00"]
H) To display only 4:00pm's weather, set end_time to the same
[tk_event_weather lat_long="38.897676,-77.03653" start_time="2016-02-01T16:00:00-05:00" end_time="2016-02-01T16:00:00-05:00" sunrise_sunset_off="true"]
I) To display Today's weather from 6am - 7pm, begin the start_time and end_time shortcode arguments at the "T" part of the ISO 8601 format. Note that you will likely need to edit the shortcode twice per year to accurately reflect the location's Daylight Savings Time (DST) UTC offset.
[tk_event_weather location="The White House" start_time=T06:00:00-0400 end_time=T19:00:00-04:00 before="Today's Forecast"]
J) To display the weather from right now through the next 3 hours. NOTE: end_time is relative to start_time, not to "now" (unless start_time is set to "now").
[tk_event_weather location="The White House" start_time="now" end_time="+3 hours"]
Example: At 12:06pm, this shortcode will display 12pm, 1pm, 2pm, 3pm, and 4pm (5 hours, possibly more if sunrise or sunset) -- because the shortcode always "bookends" the hours -- so it rounds 12:06pm down to 12:00 and rounds 3:06pm up to 4:00pm. So if you'd like only 12pm, 1pm, and 2pm to be displayed, you could add class="max-3"
to the shortcode and then also add this CSS:
.tk-event-weather__wrapper.max-3 .template-hourly_horizontal__item:nth-of-type(1n+4) { display: none; }
This plugin will work with any properly-coded WordPress theme. Free styling / customization help to integrate with your theme is not available from the plugin author.
This plugin requires WordPress version 4.3.0 or later. It is always recommended to use the latest version of WordPress for compatibility, performance, and security reasons. This plugin may not work properly with PHP versions earlier than 5.6. You should meet or exceed the WordPress recommended software specs for best performance and security. Any of this plugin's add-ons for specific event calendars would require the latest version of each add-on plugin and each event calendar plugin.
Basically, accuracy is a high priority. Here are quotes from the Dark Sky API docs:
Many thanks to the following:
https://github.com/cliffordp/tk-event-weather/compare/X.X.X...Y.Y.Y
(older version ... newer version)icon.svg
at Freemius setup promptdefine( 'TK_EVENT_WEATHER_DISABLE_UPSELLS', true );
to wp-config.php
esc_attr()
to the custom_context
shortcode argument, and, if it is used, it gets added to the wrapper class.tk_event_weather_before_full_html
to tk_event_weather_text_before
and tk_event_weather_after_full_html
to tk_event_weather_text_after
.tk_event_weather_customizer_link_to_core_section
filter, as it is irrelevant now.tk_event_weather_gmaps_geocode_request_uri_query_args
filter to allow adding things like Region Biasing.tk_event_weather_required_capability
filter.tk_event_weather_darksky_units_default
and tk_event_weather_darksky_exclude_default
filters. Added tk_event_weather_dark_sky_request_uri_query_args
filter.get_template_part_tk_event_weather_hourly_horizontal
to tk_event_weather_get_template_part_hourly_horizontal
(similar renaming for other template names)sunrise_sunset_off=true
. Example screenshot: https://cl.ly/2N2X1p1C1O1rclass
shortcode parameter (existed before but was not implemented into the output)