CRIAR META DESCRIÇÃO DE ARTIGOS AUTOMATICAMENTE
CRIAR META DESCRIÇÃO DE ARTIGOS AUTOMATICAMENTE. Adicione o seguinte código ao functions.php do seu blog, ele irá criar automaticamente a meta descrição dos seus artigos, a partir da função the_content. Tenha a certeza de que cola este código no ficheiro header.php do seu template WordPress ou o truque não irá funcionar corretamente
function create_meta_desc() {
global $post;
if (!is_single()) { return; }
$meta = strip_tags($post->post_content);
$meta = strip_shortcodes($post->post_content);
$meta = str_replace(array("\n", "\r", "\t"), ' ', $meta);
$meta = substr($meta, 0, 125);
echo "";
}
add_action('wp_head', 'create_meta_desc');
META DESCRIÇÃO DE ARTIGOS AUTOMATICAMENTE