Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mmz-srf/srf-weather-widget into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lhausammann committed Oct 3, 2023
2 parents a0e8cf2 + 531ef3b commit 274e38a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/zip-wp-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Create wp-plugin zip
on:
push:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create zip archive
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: "wp-srf-weather-widget.zip"
directory: "./wp-plugin"
path: "./srf-weather-widget"

- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: 'wp-srf-weather-widget'
path: './wp-plugin/wp-srf-weather-widget.zip'
43 changes: 43 additions & 0 deletions wp-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Wordpress Plugin for SRF Weather Widget

### Installation

tbd

### Shortcode usage

The following shortcode can be added to a post's content or in the theme of your blog at your prefered position (e.g. sidebar). Just click on the Plus-Button, choose "shortcode" and enter the widget's shortcode like below.

Most simple variant. Uses position set in wordpress settings, size s, displays next hours:
```html
[meteo]
```

Same as above, but set a specific size:
```html
[meteo size="L"]
```

Medium size and with days instead of hours:
```html
[meteo size="M" mode="days"]
```

Small widget with Bern as position:
```html
[meteo geolocation="46.9471,7.4441"]
```

Or use Bern as position by its name:
```html
[meteo locationName="Bern"]
```

### Shortcode Attributes

| Name | Attribute | Possible Values | Default | Required |
|---------------|---------------------| ------------------------ | ------------------------------------- | -------- |
| Size | size | S, M, L | S | No |
| Mode | mode | hours, three_hours, days | hours | No |
| Geolocation | geolocation | | 47.4171,8.5612 (Zürich Fernsehstudio) | No |
| Location Name | locationName | Zürich, Genf, MyLocation | | No |
2 changes: 1 addition & 1 deletion wp-plugin/srf-weather-widget/SrfWeatherWidgetApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function getForecastData($geolocationId, $accessToken)
set_transient('srf_weather_forecastpoint_' . $cacheKey, $response, self::CACHE_TTL);
}

return wp_remote_retrieve_body($response);
return wp_remote_retrieve_body($response);
}

public static function getNearestGeolocations($lat, $lon, $accessToken)
Expand Down
2 changes: 2 additions & 0 deletions wp-plugin/srf-weather-widget/meteo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @package SRF Weather Widget
*
* Plugin Name: SRF Weather Widget
* Plugin URI: https://mmz-srf.github.io/srf-weather-widget/
* Description: Add SRF Weather Widget to your posts or theme.
*/

require_once __DIR__ . '/SrfWeatherWidgetSettings.php';
Expand Down

0 comments on commit 274e38a

Please sign in to comment.