if (is_single()) : // Verifica se é um post individual
// Obtém informações básicas do post
$post_title = get_the_title();
$post_url = get_permalink();
$post_excerpt = has_excerpt() ? get_the_excerpt() : wp_trim_words(get_the_content(), 30, '...');
$post_date = get_the_date('c');
$post_modified = get_the_modified_date('c');
$post_author = get_the_author();
$featured_img_url = get_the_post_thumbnail_url(get_the_ID(), 'full');
// Obtém o nome do site
$site_name = get_bloginfo('name');
$site_url = home_url('/');
// Tenta obter o logo do site
$custom_logo_id = get_theme_mod('custom_logo');
$site_logo_url = '';
if ($custom_logo_id) {
$logo_info = wp_get_attachment_image_src($custom_logo_id, 'full');
if ($logo_info) {
$site_logo_url = $logo_info[0];
}
}
// Se não encontrar logo, usa a imagem destacada ou uma imagem padrão
if (empty($site_logo_url)) {
$site_logo_url = $featured_img_url ? $featured_img_url : '';
}
// Obtém a categoria principal
$category_name = '';
$category_url = '';
$categories = get_the_category();
if (!empty($categories)) {
$category = $categories[0];
$category_name = $category->name;
$category_url = get_category_link($category->term_id);
}
// Obtém tags
$tag_names = array();
$tags = get_the_tags();
if ($tags) {
foreach ($tags as $tag) {
$tag_names[] = $tag->name;
}
}
$tags_string = !empty($tag_names) ? implode(', ', $tag_names) : '';
// MELHORIAS: Informações avançadas de autor para E-E-A-T
$author_id = get_the_author_meta('ID');
$author_bio = get_the_author_meta('description');
$author_url = get_author_posts_url($author_id);
$author_avatar = get_avatar_url($author_id, ['size' => 96]);
// Campos personalizados de autor
$author_expertise = get_the_author_meta('expertise'); // Campo personalizado
$author_credentials = get_the_author_meta('credentials'); // Campo personalizado
$author_linkedin = get_the_author_meta('linkedin'); // Campo personalizado
$author_twitter = get_the_author_meta('twitter'); // Campo personalizado
// MELHORIAS: Informações adicionais do post
$word_count = str_word_count(strip_tags(get_the_content()));
$reading_time = ceil($word_count / 200); // Estimativa de tempo de leitura
// MELHORIAS: Verifica se o post tem vídeo incorporado
$has_video = false;
$video_url = '';
$content = get_the_content();
// Verifica se há vídeo do YouTube ou Vimeo no conteúdo
if (preg_match('/(youtube\.com|youtu\.be|vimeo\.com)/i', $content)) {
$has_video = true;
// Tenta extrair a URL do vídeo
if (preg_match('/youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/i', $content, $matches)) {
$video_url = 'https://www.youtube.com/watch?v=' . $matches[1];
} elseif (preg_match('/youtu\.be\/([a-zA-Z0-9_-]+)/i', $content, $matches)) {
$video_url = 'https://youtu.be/' . $matches[1];
} elseif (preg_match('/vimeo\.com\/([0-9]+)/i', $content, $matches)) {
$video_url = 'https://vimeo.com/' . $matches[1];
}
}
// MELHORIAS: Verifica se o post tem Web Story associada
$has_web_story = false;
$web_story_url = '';
// Verifica se o plugin Web Stories está ativo e se há uma história associada
if (function_exists('web_stories_get_story_id_from_post')) {
$story_id = web_stories_get_story_id_from_post(get_the_ID());
if ($story_id) {
$has_web_story = true;
$web_story_url = get_permalink($story_id);
}
}
// MELHORIAS: Obtém dimensões da imagem destacada para proporção correta
$image_width = 0;
$image_height = 0;
if ($featured_img_url) {
$attachment_id = get_post_thumbnail_id(get_the_ID());
if ($attachment_id) {
$image_data = wp_get_attachment_image_src($attachment_id, 'full');
if ($image_data) {
$image_width = $image_data[1];
$image_height = $image_data[2];
}
}
}
// Verifica requisitos de imagem para Google Discover
$image_meets_requirements = ($image_width >= 1200);
$image_ratio = $image_width > 0 && $image_height > 0 ? $image_width / $image_height : 0;
$has_ideal_ratio = ($image_ratio >= 1.3 && $image_ratio <= 2.0);
?>
FAQ') !== false ||
strpos($content, 'Como') !== false ||
strpos($content, '


