Funciones
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 argumentos: style (inline, stack, dropdown, select), flags (bool), show_label (bool), class (string).
Ejemplo:
<?php if ( 'en' === pht_current_language() ) : ?>
<p>Free shipping to the UK.</p>
<?php endif; ?>
Shortcode
[pht_switcher show_label="no" class="my-class"]
Filtros
| Filtro | Para qué sirve |
|---|---|
pht_translatable_attributes | Lista de atributos HTML traducibles por elemento (recibe la lista y el nombre del elemento) |
pht_search_params | Parámetros de la URL tratados como un término de búsqueda (por defecto q, s, search, term, query) |
pht_gettext_sources | Carpetas de donde se leen los textos del tema y el plugin |
Acciones
| Acción | Cuando se activa |
|---|---|
pht_purge_urls | Después de traducir; recibe las direcciones traducidas que se deben purgar de la caché |
pht_purge_all | Después de una ejecución larga; pide que se vacíe toda la caché |
Para conectar un sistema de caché que el plugin no conoce:
add_action( 'pht_purge_urls', function ( array $urls ) {
foreach ( $urls as $url ) {
my_cache_purge( $url );
}
} );
Variables CSS del conmutador
Definido en .pht-switcher: --pht-bg, --pht-fg, --pht-hover, --pht-radius y el resto de la sección de Apariencia.
Constante
define( 'PHT_LICENSE_KEY', 'PHT-...' );