Skip to content

Instantly share code, notes, and snippets.

@marcelotorres
Last active March 14, 2017 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelotorres/e0626fec1daa5b0704ce276b14adafba to your computer and use it in GitHub Desktop.
Save marcelotorres/e0626fec1daa5b0704ce276b14adafba to your computer and use it in GitHub Desktop.
Customizando a saída de texto da tag 'title' e a 'meta description' ao usar o plugin Yoast SEO
<?php
add_filter('wpseo_title', 'filter_wpseo_title');
function filter_wpseo_title($title) {
if( is_tax( 'mes-alimento') ) {
$title = 'Frutas, verduras e legumes do mês de '.ucfirst(strftime("%B", mktime(0, 0, 0, get_queried_object()->slug) )); // Mostra o nome do mês e não o numero
}
return $title;
}
add_filter('wpseo_metadesc', 'filter_wpseo_description');
function filter_wpseo_description($description) {
if( is_tax( 'mes-alimento') ) {
$description = 'Confira aqui as frutas, verduras e legumes do mês de '. ucfirst(strftime("%B", mktime(0, 0, 0, get_queried_object()->slug) )) . ', como, '. get_short_alimento_list('mes-alimento', get_queried_object()->slug, 'an') .'...veja todos'; // Mostra o nome do mês e não o numero
}
if( is_tax( 'categoria-alimento') ) {
$description = 'Confira aqui '. ucfirst(get_queried_object()->slug) .', como, '. get_short_alimento_list('categoria-alimento', get_queried_object()->slug, 'an') .', e seus respectivos meses de produção'; // Mostra o nome do mês e não o numero
}
return $description;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment