List options
Four widgets list places: the levada walks ([madeira_weather_levadas]), the trails ([madeira_weather_trails]), the viewpoints ([madeira_weather_viewpoints]) and the beaches ([madeira_weather_beaches]). Since 3.4 they share one set of options, so what you learn on one works on all four.
| Attribute | Default | What it does |
|---|---|---|
show | all | all, good or best: see below |
empty | message | What to do when show="good" finds nothing: message, hide or fallback |
limit | the widget's own | How many at most. With show="best" the default is 3. 0 is all |
region | all | north, south, west, east, mountains, porto-santo, separated by commas |
near | A town of your site to measure from | |
radius | With near: only places within this many kilometres | |
sort | best | best, name or distance (distance needs near) |
per_page | Show this many at a time | |
paginate | pages | pages: page buttons. more: one "Show more" button |
filters | false | true: buttons above the list for the visitor |
show: all, good, best
- all lists everything the other options leave, best first.
- good keeps only what is good right now, or, for walks and viewpoints, for the day or the moment the widget is about (tomorrow's walks in the evening, tomorrow's sunrise at night). A place is good only when the weather engine says so, and the engine never says so under an IPMA warning for the place, in the dark, in a rough sea, or for a trail that is closed. So
show="good"can never contradict a warning: the order is the same as on the cards, warnings, then daylight, then the weather. - best shows the top few, ranked by the same scores (
limit, default 3). Withsort="name"the top few are listed alphabetically.
empty: when nothing is good
With show="good", a bad day has no good place. Then:
empty="message"(default) says it in a short line: "No great beach weather right now", "No great walking weather right now", "No great viewpoint weather right now".empty="hide"removes the widget completely, so the page has no hole.empty="fallback"shows the best available and labels them "Best available, not ideal". They keep their own verdict, so a place under a warning still says so.
region, near and radius
A place's region comes from where it is and how high: Porto Santo, then the mountains (900 m and over, and the known mountain viewpoints), the east (Machico, Caniçal, Ponta de São Lourenço), the south-west (Calheta, Jardim do Mar, Ponta do Sol), the north coast, and the south. near="Funchal" measures a straight line from that town of yours, and shows "12 km from Funchal" on each place. A town you have not enabled is ignored.
sort
best ranks by the score the widget already uses: the walk's score, a trail's weather, the calmest sea and warmest water for a beach, the clearest sky for a viewpoint. A closed trail always goes last. name ignores accents. distance puts the nearest first.
per_page and paginate
per_page="6" shows six at a time. paginate="pages" adds Previous, the page numbers and Next; paginate="more" adds one button, "Show 6 more", that adds to the list. It all runs in the visitor's browser over the list your page already holds, so a page cache (SWIS, WP Rocket and the like) keeps working. The buttons are real buttons, work with the keyboard, tell screen readers what is shown ("Showing 7 to 12 of 22" is read aloud when it changes) and keep the focus where the visitor pressed. A list that fits on one page shows no pager. Without JavaScript the whole list shows.
filters
filters="true" puts buttons above the list. Only the groups that make sense for the list appear, and only when there are at least two choices:
- Region, on every list.
- Open only, for trails and walks that can be closed.
- Difficulty (easy, medium, hard) and Length (under 5 km, 5 to 10 km, over 10 km), for walks and trails where the data has them.
- Type, for beaches: sand, pebbles, natural pools, bathing complexes.
filters="region,type" offers only those groups. The visitor's choice is kept in the page address after a #, for example #beaches=region:north,type:pools,page:2, so a link can be shared and the back button follows it, and it never changes what the server sends, so page caches stay valid. Several lists on one page keep their own choice.
Examples
[madeira_weather_beaches show="good" empty="fallback" filters="true" per_page="6"]
[madeira_weather_levadas limit="0" region="north,mountains" per_page="8" filters="true"]
[madeira_weather_trails show="best" limit="5"]
[madeira_weather_viewpoints at="sunset" near="Funchal" radius="20" sort="distance"]
For one walk, one beach and one viewpoint in a card, see Best today in Madeira.