feat: il widget ha tre aspetti (elenco, schede con locandina, carosello) e i comuni si tagliano al limite del servizio
This commit is contained in:
parent
5c73bbc2b8
commit
fbae03e4f3
7 changed files with 71 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ function pinfesta_defaults() {
|
|||
'regione' => '',
|
||||
'categoria' => '',
|
||||
'limite' => '5',
|
||||
'formato' => 'lista',
|
||||
'tema' => 'chiaro',
|
||||
'colore' => '',
|
||||
'titolo' => '',
|
||||
|
|
@ -55,8 +56,12 @@ function pinfesta_categorie() {
|
|||
|
||||
/**
|
||||
* Cleans a comma separated list of town identifiers (the slug you see in the
|
||||
* address of a town page, for instance "la-morra"). Twelve at most, which is
|
||||
* what the service accepts.
|
||||
* address of a town page, for instance "la-morra").
|
||||
*
|
||||
* The hard limit is the service's, not ours: twelve towns on the free plan,
|
||||
* fifty with a key. Here we only cut at the higher of the two, so a site with
|
||||
* a key is not trimmed by the plugin; the extra towns are simply ignored by
|
||||
* the service when the key is missing.
|
||||
*
|
||||
* @param string $raw Raw attribute value.
|
||||
* @return string Normalised list, empty when nothing survives.
|
||||
|
|
@ -72,7 +77,7 @@ function pinfesta_clean_comuni( $raw ) {
|
|||
}
|
||||
}
|
||||
|
||||
return implode( ',', array_slice( array_unique( $out ), 0, 12 ) );
|
||||
return implode( ',', array_slice( array_unique( $out ), 0, 50 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,6 +107,11 @@ function pinfesta_build_url( $args ) {
|
|||
$query['limite'] = min( $limite, 20 );
|
||||
}
|
||||
|
||||
// Elenco, schede con la locandina, o carosello che scorre da solo.
|
||||
if ( in_array( $args['formato'], array( 'schede', 'carosello' ), true ) ) {
|
||||
$query['formato'] = $args['formato'];
|
||||
}
|
||||
|
||||
if ( 'scuro' === $args['tema'] ) {
|
||||
$query['tema'] = 'scuro';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue