Documentação

Para desenvolvedores

Funções

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).

Exemplo:

<?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

FiltroPara que serve
pht_translatable_attributesLista de atributos HTML traduzíveis por elemento (recebe a lista e o nome do elemento)
pht_search_paramsParâmetros de URL tratados como um termo de pesquisa (por padrão) q, s, search, term, query)
pht_gettext_sourcesPastas de onde são lidas as traduções do tema e do plugin

Ações

AçãoQuando é acionado
pht_purge_urlsApós traduzir; recebe os endereços traduzidos a eliminar do cache
pht_purge_allApós uma grande execução; pede que todo o cache seja esvaziado

Para conectar um sistema de cache que o plugin não conhece:

add_action( 'pht_purge_urls', function ( array $urls ) {
	foreach ( $urls as $url ) {
		my_cache_purge( $url );
	}
} );

Variáveis CSS do switcher

Definido em .pht-switcher: --pht-bg, --pht-fg, --pht-hover, --pht-radius e o resto da seção de Aparência.

Constante

define( 'PHT_LICENSE_KEY', 'PHT-...' );

Publicar.
Leia em
todas as línguas.

30.000 caracteres, um site, sem cartão. A chave chega por e-mail após a finalização da compra.