Last active
March 14, 2017 20:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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