Funzioni
pht_switcher( array $args = [] ); // prints the switcher
pht_get_switcher( array $args = [] ); // returns the switcher's HTML
pht_current_language(); // current language prefix ('' in the source language)
$args argomenti: style (inline, stack, dropdown, select), flags (bool), show_label (bool), class (string).
Esempio:
<?php if ( 'en' === pht_current_language() ) : ?>
<p>Free shipping to the UK.</p>
<?php endif; ?>
Shortcode
[pht_switcher show_label="no" class="my-class"]
Filtri
| Filtro | A cosa serve |
|---|---|
pht_translatable_attributes | Elenco degli attributi HTML traducibili per elemento (riceve l'elenco e il nome dell'elemento) |
pht_search_params | Parametri URL trattati come termini di ricerca (per impostazione predefinita q, s, search, term, query) |
pht_gettext_sources | Cartelle da cui vengono letti i testi del tema e del plugin |
Azioni
| Azione | Quando si attiva |
|---|---|
pht_purge_urls | Dopo la traduzione; riceve gli indirizzi tradotti da rimuovere dalla cache |
pht_purge_all | Dopo un grande intervento; chiede di svuotare completamente la cache |
Per connettere un sistema di caching che il plugin non conosce:
add_action( 'pht_purge_urls', function ( array $urls ) {
foreach ( $urls as $url ) {
my_cache_purge( $url );
}
} );
Variabili CSS dello switcher
Definito su .pht-switcher: --pht-bg, --pht-fg, --pht-hover, --pht-radius e il resto dalla sezione Aspetto.
Costante
define( 'PHT_LICENSE_KEY', 'PHT-...' );