Initial commit

This commit is contained in:
2025-09-12 21:24:58 -03:00
commit b8ce07158c
14 changed files with 3873 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

123
README.md Normal file
View File

@@ -0,0 +1,123 @@
# NewSTC - Tema WordPress para Notícias Corporativas
`NewSTC` é um tema moderno, limpo e responsivo para WordPress, projetado especificamente para portais de notícias corporativas, intranets e sites de comunicação interna. Com um design focado na legibilidade e na experiência do usuário, o tema oferece funcionalidades avançadas para destacar conteúdo e facilitar o acesso à informação.
**Versão:** 1.0
**Autor:** Marco Antonio Vivas
---
## ✨ Funcionalidades Principais
* **Design Moderno e Responsivo:** Layout adaptável para uma visualização perfeita em desktops, tablets e celulares.
* **Página Inicial Configurável:** Seções pré-definidas para herói, notícias em destaque, últimas notícias e acesso rápido.
* **Botões de Acesso Rápido Gerenciáveis:** Crie, edite, ordene e remova os botões de atalho da página inicial diretamente pelo painel do WordPress, através de um Custom Post Type dedicado.
* **Notícias em Destaque por Categoria:** Destaque posts na página inicial simplesmente adicionando-os à categoria "Destaque".
* **Layout de Post Otimizado:** Página de post com design focado no conteúdo, sem distrações, com tempo de leitura estimado e botões de compartilhamento social e impressão.
* **Áreas de Widgets:** Múltiplas áreas para widgets, incluindo uma sidebar principal e três colunas no rodapé.
* **Menus Configuráveis:** Duas localizações de menu: um principal no cabeçalho e um secundário no rodapé.
* **Otimizado para SEO:** Estrutura de código limpa e adição de Schema Markup (JSON-LD) para artigos, melhorando a visibilidade nos motores de busca.
* **Performance:** Otimizações como remoção de emojis e lazy loading para imagens.
---
## 🚀 Instalação
1. Faça o download do arquivo `.zip` do tema.
2. No painel do WordPress, navegue até **Aparência > Temas**.
3. Clique em **Adicionar novo** e depois em **Enviar tema**.
4. Selecione o arquivo `.zip` que você baixou e clique em **Instalar agora**.
5. Após a instalação, clique em **Ativar**.
---
## ⚙️ Configuração do Tema
Após ativar o tema, siga estes passos para configurar seu site.
### 1. Configurar a Página Inicial
O tema `NewSTC` foi projetado para usar uma página inicial estática.
1. Crie uma nova página em **Páginas > Adicionar nova** e dê a ela o título de "Início" (ou como preferir).
2. Crie outra página chamada "Blog" ou "Notícias" para ser a página de listagem dos posts.
3. Vá para **Configurações > Leitura**.
4. Em "Sua página inicial exibe", selecione **Uma página estática**.
5. Para "Página inicial", selecione a página "Início" que você criou.
6. Para "Página de posts", selecione a página "Blog" ou "Notícias".
7. Salve as alterações.
### 2. Menus
O tema possui duas localizações de menu:
* **Menu Principal:** Exibido no cabeçalho.
* **Menu do Rodapé:** Exibido no rodapé do site.
Vá para **Aparência > Menus** para criar seus menus e atribuí-los às suas respectivas localizações.
### 3. Notícias em Destaque
A seção "Notícias em Destaque" na página inicial exibe os posts de uma categoria específica.
1. Vá para **Posts > Categorias**.
2. Crie uma nova categoria com o nome **Destaque**. O slug (URL amigável) deve ser `destaque`.
3. Para que um post apareça nesta seção, basta atribuir a ele a categoria "Destaque". Os 2 posts mais recentes desta categoria serão exibidos.
### 4. Botões de Acesso Rápido (Home)
Os botões de atalho na página inicial são gerenciados através de um tipo de post personalizado chamado "Acesso Rápido".
1. No menu lateral do painel, clique em **Acesso Rápido > Adicionar Novo**.
2. **Título:** Será o título do botão (ex: "Últimas Notícias").
3. **Editor de Conteúdo:** O texto que você inserir aqui será a descrição curta do botão.
4. **Caixa "Detalhes do Botão"**:
* **Ícone:** Insira a classe do ícone desejado do Font Awesome (ex: `fas fa-newspaper`).
* **Link do Botão:** Insira a URL de destino para onde o botão deve levar.
5. **Caixa "Atributos da página" (na barra lateral direita)**:
* Use o campo **Ordem** para definir a posição do botão (0 para o primeiro, 1 para o segundo, e assim por diante).
6. Clique em **Publicar**.
Você pode adicionar, editar ou remover quantos botões desejar.
### 5. Widgets
O tema oferece 4 áreas de widgets:
* **Sidebar Principal:** Aparece ao lado do conteúdo em páginas de arquivo (como o blog).
* **Rodapé - Coluna 1, 2 e 3:** Permitem adicionar conteúdo em três colunas no rodapé do site.
Vá para **Aparência > Widgets** para adicionar e configurar os widgets.
### 6. Informações de Contato e Redes Sociais
As informações de contato (telefone, e-mail) e os links para redes sociais exibidos no topo e no rodapé podem ser configurados através do **Personalizador** do WordPress.
1. Vá para **Aparência > Personalizar**.
2. Procure pelas seções correspondentes para inserir suas informações.
*(Nota: Se as seções não existirem, elas precisam ser criadas no arquivo `functions.php` usando a API do Customizer).*
---
## 🧱 Dependências
O tema utiliza as seguintes bibliotecas externas:
* **Google Fonts:** Para as fontes `Inter` e `Plus Jakarta Sans`.
* **Font Awesome:** Para os ícones utilizados em todo o site.
Esses recursos são carregados automaticamente pelo tema.
---
## 📄 Licença
Este tema é licenciado sob a **GNU General Public License v2.0** ou posterior.
Você pode encontrar o texto completo da licença em: http://www.gnu.org/licenses/gpl-2.0.html
---
## 👨‍💻 Créditos
Desenvolvido e mantido por **Marco Antonio Vivas**.

71
footer.php Normal file
View File

@@ -0,0 +1,71 @@
<?php
/**
* O rodapé do tema
*
* Contém o fechamento do elemento #page e todo o conteúdo após isso.
*
* @package NewSTC
*/
?>
<footer id="colophon" class="site-footer">
<div class="footer-widgets">
<div class="container">
<div class="footer-widget-area">
<?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
<div class="footer-widget footer-widget-1">
<?php dynamic_sidebar( 'footer-1' ); ?>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'footer-2' ) ) : ?>
<div class="footer-widget footer-widget-2">
<?php dynamic_sidebar( 'footer-2' ); ?>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'footer-3' ) ) : ?>
<div class="footer-widget footer-widget-3">
<?php dynamic_sidebar( 'footer-3' ); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="site-info">
<div class="container">
<div class="copyright">
&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. <?php esc_html_e('Todos os direitos reservados.', 'newstc'); ?>
</div>
<div class="footer-menu">
<?php
wp_nav_menu(
array(
'theme_location' => 'footer',
'menu_id' => 'footer-menu',
'depth' => 1,
'container' => false,
'fallback_cb' => false,
)
);
?>
</div>
<div class="footer-social">
<a href="#" class="social-icon"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="social-icon"><i class="fab fa-twitter"></i></a>
<a href="#" class="social-icon"><i class="fab fa-instagram"></i></a>
<a href="#" class="social-icon"><i class="fab fa-linkedin-in"></i></a>
</div>
</div>
</div>
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>

188
front-page.php Normal file
View File

@@ -0,0 +1,188 @@
<?php
/**
* Template para a página inicial
*
* @package NewSTC
*/
get_header();
?>
<main id="primary" class="site-main">
<section class="hero-section">
<div class="container">
<div class="hero-content">
<h1><?php esc_html_e('Notícias Corporativas', 'newstc'); ?></h1>
<p><?php esc_html_e('Mantenha-se atualizado com as últimas notícias e informações da empresa', 'newstc'); ?></p>
<div class="hero-cta">
<a href="<?php echo esc_url(get_permalink(get_option('page_for_posts'))); ?>" class="btn btn-white">
<i class="fas fa-newspaper"></i> <?php esc_html_e('Ver Notícias', 'newstc'); ?>
</a>
<a href="#" class="btn btn-secondary">
<i class="fas fa-info-circle"></i> <?php esc_html_e('Saiba Mais', 'newstc'); ?>
</a>
</div>
</div>
</div>
</section>
<section class="quick-access">
<div class="container">
<div class="quick-access-buttons">
<?php
$buttons_query = new WP_Query(array(
'post_type' => 'quick_access_button',
'posts_per_page' => -1, // Mostra todos os botões
'orderby' => 'menu_order',
'order' => 'ASC'
));
if ($buttons_query->have_posts()) :
while ($buttons_query->have_posts()) : $buttons_query->the_post();
$icon = get_post_meta(get_the_ID(), '_button_icon', true);
$link = get_post_meta(get_the_ID(), '_button_link', true);
?>
<a href="<?php echo esc_url($link); ?>" class="quick-access-button">
<?php if ($icon) : ?>
<div class="quick-access-icon"><i class="<?php echo esc_attr($icon); ?>"></i></div>
<?php endif; ?>
<h3 class="quick-access-title"><?php the_title(); ?></h3>
<div class="quick-access-description"><?php the_content(); ?></div>
</a>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
</section>
<section class="featured-news">
<div class="container">
<h2 class="section-title"><?php esc_html_e('Notícias em Destaque', 'newstc'); ?></h2>
<div class="featured-news-container">
<div class="news-main">
<div class="featured-news-grid">
<?php
$featured_args = array(
'posts_per_page' => 2,
'category_name' => 'destaque', // Mostra posts da categoria "destaque"
'ignore_sticky_posts' => 1,
);
$featured_query = new WP_Query($featured_args);
if ($featured_query->have_posts()) :
while ($featured_query->have_posts()) : $featured_query->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('featured-news-item'); ?>>
<div class="featured-thumbnail">
<?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('large'); ?>
</a>
<?php endif; ?>
<div class="featured-badge"><?php esc_html_e('Destaque', 'newstc'); ?></div>
</div>
<div class="featured-content">
<header class="featured-header">
<h3 class="featured-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php newstc_post_meta(); ?>
</header>
<div class="featured-excerpt">
<?php the_excerpt(); ?>
</div>
<footer class="featured-footer">
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'newstc'); ?></a>
</footer>
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else :
?>
<p><?php esc_html_e('Nenhuma notícia em destaque encontrada.', 'newstc'); ?></p>
<?php
endif;
?>
</div>
</div>
<div class="sidebar">
<div class="sidebar-widget calendar-widget">
<div class="calendar-container">
<?php echo do_shortcode('[mostra-calendario-widget]'); ?>
</div>
</div>
<div class="sidebar-widget events-widget">
<div class="events-list">
<?php echo do_shortcode('[mostra-prox-eventos]'); ?>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="latest-news">
<div class="container">
<h2 class="section-title"><?php esc_html_e('Últimas Notícias', 'newstc'); ?></h2>
<div class="news-grid">
<?php
$latest_args = array(
'posts_per_page' => 6,
'ignore_sticky_posts' => 1
);
$latest_query = new WP_Query($latest_args);
if ($latest_query->have_posts()) :
while ($latest_query->have_posts()) : $latest_query->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('news-card'); ?>>
<div class="news-thumbnail">
<?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('medium'); ?>
</a>
<?php endif; ?>
</div>
<div class="news-content">
<header class="news-header">
<h3 class="news-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="news-meta">
<span class="news-date"><i class="far fa-calendar-alt"></i> <?php echo get_the_date(); ?></span>
<span class="news-author"><i class="far fa-user"></i> <?php the_author(); ?></span>
</div>
</header>
<div class="news-excerpt">
<?php the_excerpt(); ?>
</div>
<footer class="news-footer">
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'newstc'); ?></a>
</footer>
</div>
</article>
<?php
endwhile;
wp_reset_postdata();
else :
?>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'newstc'); ?></p>
<?php
endif;
?>
</div>
<div class="view-all">
<a href="<?php echo esc_url(get_permalink(get_option('page_for_posts'))); ?>" class="btn btn-primary"><?php esc_html_e('Ver todas as notícias', 'newstc'); ?></a>
</div>
</div>
</section>
</main><!-- #main -->
<?php
get_footer();

479
functions.php Normal file
View File

@@ -0,0 +1,479 @@
<?php
/**
* NewSTC functions and definitions
*
* @package NewSTC
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly.
}
// Definição de constantes do tema
define('NEWSTC_VERSION', '1.0.0');
define('NEWSTC_TEMPLATE_DIR', get_template_directory());
define('NEWSTC_TEMPLATE_URI', get_template_directory_uri());
// Configuração do tema
if (!function_exists('newstc_setup')) :
function newstc_setup() {
// Suporte a traduções
load_theme_textdomain('newstc', NEWSTC_TEMPLATE_DIR . '/languages');
// Suporte a tags do HTML5
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
));
// Suporte a título
add_theme_support('title-tag');
// Suporte a thumbnails
add_theme_support('post-thumbnails');
// Tamanhos de imagem personalizados
add_image_size('newstc-featured', 800, 500, true);
add_image_size('newstc-card', 400, 250, true);
add_image_size('newstc-thumbnail', 150, 150, true);
// Suporte a menus
register_nav_menus(array(
'primary' => __('Menu Principal', 'newstc'),
'footer' => __('Menu do Rodapé', 'newstc'),
));
// Suporte a widgets
add_theme_support('widgets');
add_theme_support('widgets-block-editor');
// Suporte a logo personalizada
add_theme_support('custom-logo', array(
'height' => 60,
'width' => 200,
'flex-height' => true,
'flex-width' => true,
));
// Suporte a wide alignment no editor
add_theme_support('align-wide');
// Suporte a estilos do editor
add_theme_support('editor-styles');
add_editor_style('assets/css/editor-style.css');
// Suporte a core block patterns
add_theme_support('core-block-patterns');
// Remover estilos padrão da galeria
add_filter('use_default_gallery_style', '__return_false');
}
endif;
add_action('after_setup_theme', 'newstc_setup');
// Enfileirar scripts e estilos
function newstc_scripts() {
// Estilo principal
wp_enqueue_style('newstc-style', get_stylesheet_uri(), array(), NEWSTC_VERSION);
// Google Fonts
wp_enqueue_style('newstc-google-fonts', 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap', array(), null);
// Font Awesome
wp_enqueue_style('newstc-font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css', array(), '6.4.0');
// Script principal
wp_enqueue_script('newstc-script', NEWSTC_TEMPLATE_URI . '/assets/js/main.js', array(), NEWSTC_VERSION, true);
// Adiciona dados para scripts
wp_localize_script('newstc-script', 'newstc_ajax', array(
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('newstc_nonce')
));
}
add_action('wp_enqueue_scripts', 'newstc_scripts');
// Registrar áreas de widgets
function newstc_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar Principal', 'newstc'),
'id' => 'sidebar-1',
'description' => __('Widgets que aparecem na sidebar principal.', 'newstc'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 1', 'newstc'),
'id' => 'footer-1',
'description' => __('Widgets que aparecem na primeira coluna do rodapé.', 'newstc'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 2', 'newstc'),
'id' => 'footer-2',
'description' => __('Widgets que aparecem na segunda coluna do rodapé.', 'newstc'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 3', 'newstc'),
'id' => 'footer-3',
'description' => __('Widgets que aparecem na terceira coluna do rodapé.', 'newstc'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
}
add_action('widgets_init', 'newstc_widgets_init');
// Funções personalizadas
function newstc_post_meta() {
$reading_time = newstc_reading_time();
echo '<div class="post-meta">';
echo '<span class="post-date"><i class="far fa-calendar-alt"></i> ' . get_the_date() . '</span>';
echo '<span class="post-reading-time"><i class="far fa-clock"></i> ' . esc_html($reading_time) . '</span>';
echo '</div>';
}
function newstc_reading_time() {
$content = get_post_field('post_content', get_the_ID());
$word_count = str_word_count(strip_tags($content));
$reading_time = ceil($word_count / 200); // Média de 200 palavras por minuto
if ($reading_time < 1) {
return __('Menos de 1 min de leitura', 'newstc');
}
$time_string = sprintf(_n('%s min de leitura', '%s min de leitura', $reading_time, 'newstc'), $reading_time);
return $time_string;
}
function newstc_quick_access_buttons() {
$buttons = array(
array(
'icon' => 'fas fa-newspaper',
'title' => __('Notícias', 'newstc'),
'description' => __('Acesse todas as notícias da empresa', 'newstc'),
'link' => get_permalink(get_option('page_for_posts'))
),
array(
'icon' => 'fas fa-calendar-alt',
'title' => __('Eventos', 'newstc'),
'description' => __('Confira nosso calendário de eventos', 'newstc'),
'link' => '#calendar'
),
array(
'icon' => 'fas fa-users',
'title' => __('Equipe', 'newstc'),
'description' => __('Conheça nossa equipe de colaboradores', 'newstc'),
'link' => '#team'
),
array(
'icon' => 'fas fa-info-circle',
'title' => __('Sobre', 'newstc'),
'description' => __('Saiba mais sobre nossa empresa', 'newstc'),
'link' => '#about'
)
);
echo '<section class="quick-access">';
echo '<div class="container">';
echo '<div class="quick-access-buttons">';
foreach ($buttons as $button) {
echo '<a href="' . esc_url($button['link']) . '" class="quick-access-button">';
echo '<div class="quick-access-icon"><i class="' . esc_attr($button['icon']) . '"></i></div>';
echo '<h3 class="quick-access-title">' . esc_html($button['title']) . '</h3>';
echo '<p class="quick-access-description">' . esc_html($button['description']) . '</p>';
echo '</a>';
}
echo '</div>';
echo '</div>';
echo '</section>';
}
// Função para botões de compartilhamento social
function newstc_social_share() {
$post_url = urlencode(get_permalink());
$post_title = urlencode(get_the_title());
$social_links = [
'facebook' => 'https://www.facebook.com/sharer/sharer.php?u=' . $post_url,
'twitter' => 'https://twitter.com/intent/tweet?text=' . $post_title . '&url=' . $post_url,
'linkedin' => 'https://www.linkedin.com/shareArticle?mini=true&url=' . $post_url . '&title=' . $post_title,
'whatsapp' => 'https://api.whatsapp.com/send?text=' . $post_title . ' ' . $post_url,
];
echo '<div class="post-share">';
echo '<span class="share-label">' . esc_html__('Compartilhar:', 'newstc') . '</span>';
echo '<div class="share-buttons">';
foreach ($social_links as $platform => $link) {
echo '<a href="' . esc_url($link) . '" class="share-btn ' . esc_attr($platform) . '" target="_blank" rel="noopener noreferrer">';
echo '<i class="fab fa-' . esc_attr($platform) . '"></i>';
echo '</a>';
}
// Botão de Imprimir
echo '<button onclick="window.print()" class="share-btn print-btn" title="' . esc_attr__('Imprimir', 'newstc') . '">';
echo '<i class="fas fa-print"></i>';
echo '</button>';
echo '</div></div>';
}
// Shortcodes personalizados
function newstc_calendar_shortcode($atts) {
$atts = shortcode_atts(array(
'show_title' => true,
'show_navigation' => true
), $atts);
ob_start();
?>
<div class="newstc-calendar">
<?php if ($atts['show_title']) : ?>
<h3><?php _e('Calendário de Eventos', 'newstc'); ?></h3>
<?php endif; ?>
<?php echo do_shortcode('[mostra-calendario-widget]'); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('newstc_calendar', 'newstc_calendar_shortcode');
function newstc_events_shortcode($atts) {
$atts = shortcode_atts(array(
'limit' => 5,
'show_title' => true
), $atts);
ob_start();
?>
<div class="newstc-events">
<?php if ($atts['show_title']) : ?>
<h3><?php _e('Próximos Eventos', 'newstc'); ?></h3>
<?php endif; ?>
<?php echo do_shortcode('[mostra-prox-eventos]'); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('newstc_events', 'newstc_events_shortcode');
// Otimizações e funcionalidades adicionais
function newstc_excerpt_length($length) {
return 25;
}
add_filter('excerpt_length', 'newstc_excerpt_length');
function newstc_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'newstc_excerpt_more');
// Suporte a SVG
function newstc_svg_support($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'newstc_svg_support');
// Remover emojis do WordPress (para melhor performance)
function newstc_disable_emojis() {
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
}
add_action('init', 'newstc_disable_emojis');
// Otimizar consultas do WordPress
function newstc_optimize_queries($query) {
if (!is_admin() && $query->is_main_query()) {
if ($query->is_home() || $query->is_front_page()) {
$query->set('posts_per_page', 6);
}
}
}
add_action('pre_get_posts', 'newstc_optimize_queries');
// Adicionar suporte a WebP
function newstc_webp_support($mimes) {
$mimes['webp'] = 'image/webp';
return $mimes;
}
add_filter('mime_types', 'newstc_webp_support');
// Customizar a pesquisa
function newstc_search_filter($query) {
if ($query->is_search && !is_admin()) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts', 'newstc_search_filter');
// Adicionar suporte a lazy loading para imagens
function newstc_lazy_load_images($content) {
if (is_feed() || is_admin()) {
return $content;
}
$content = preg_replace_callback('/<img[^>]+/', function($matches) {
$img = $matches[0];
// Skip if already has lazy loading
if (strpos($img, 'loading=') !== false) {
return $img;
}
// Add loading="lazy" attribute
$img = preg_replace('/<img(.*?)>/i', '<img$1 loading="lazy">', $img);
return $img;
}, $content);
return $content;
}
add_filter('the_content', 'newstc_lazy_load_images');
// Adicionar schema markup para melhor SEO
function newstc_schema_markup() {
if (is_single()) {
$schema = array(
'@context' => 'https://schema.org',
'@type' => 'NewsArticle',
'headline' => get_the_title(),
'datePublished' => get_the_date('c'),
'dateModified' => get_the_modified_date('c'),
'author' => array(
'@type' => 'Person',
'name' => get_the_author()
),
'publisher' => array(
'@type' => 'Organization',
'name' => get_bloginfo('name'),
'logo' => array(
'@type' => 'ImageObject',
'url' => wp_get_attachment_url(get_theme_mod('custom_logo'))
)
)
);
if (has_post_thumbnail()) {
$schema['image'] = array(
'@type' => 'ImageObject',
'url' => get_the_post_thumbnail_url(),
'width' => 1200,
'height' => 630
);
}
echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
}
}
add_action('wp_head', 'newstc_schema_markup');
/**
* Custom Post Type para Botões de Acesso Rápido.
*/
function newstc_register_quick_access_cpt() {
$labels = array(
'name' => _x( 'Botões de Acesso Rápido', 'Post Type General Name', 'newstc' ),
'singular_name' => _x( 'Botão de Acesso Rápido', 'Post Type Singular Name', 'newstc' ),
'menu_name' => __( 'Acesso Rápido', 'newstc' ),
'name_admin_bar' => __( 'Botão de Acesso Rápido', 'newstc' ),
'archives' => __( 'Arquivos de Botões', 'newstc' ),
'attributes' => __( 'Atributos do Botão', 'newstc' ),
'parent_item_colon' => __( 'Botão Pai:', 'newstc' ),
'all_items' => __( 'Todos os Botões', 'newstc' ),
'add_new_item' => __( 'Adicionar Novo Botão', 'newstc' ),
'add_new' => __( 'Adicionar Novo', 'newstc' ),
'new_item' => __( 'Novo Botão', 'newstc' ),
'edit_item' => __( 'Editar Botão', 'newstc' ),
'update_item' => __( 'Atualizar Botão', 'newstc' ),
'view_item' => __( 'Ver Botão', 'newstc' ),
'view_items' => __( 'Ver Botões', 'newstc' ),
'search_items' => __( 'Procurar Botão', 'newstc' ),
);
$args = array(
'label' => __( 'Botão de Acesso Rápido', 'newstc' ),
'description' => __( 'Botões para a seção de acesso rápido na home.', 'newstc' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'page-attributes' ),
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-screenoptions',
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'page',
);
register_post_type( 'quick_access_button', $args );
}
add_action( 'init', 'newstc_register_quick_access_cpt', 0 );
/**
* Meta Box para campos extras dos botões.
*/
function newstc_quick_access_meta_box() {
add_meta_box( 'quick_access_details', __( 'Detalhes do Botão', 'newstc' ), 'newstc_quick_access_meta_box_callback', 'quick_access_button' );
}
add_action( 'add_meta_boxes', 'newstc_quick_access_meta_box' );
function newstc_quick_access_meta_box_callback( $post ) {
wp_nonce_field( 'newstc_save_quick_access_meta', 'newstc_quick_access_nonce' );
$icon = get_post_meta( $post->ID, '_button_icon', true );
$link = get_post_meta( $post->ID, '_button_link', true );
?>
<p>
<label for="button_icon"><?php esc_html_e( 'Ícone (ex: fas fa-newspaper):', 'newstc' ); ?></label>
<input type="text" id="button_icon" name="button_icon" value="<?php echo esc_attr( $icon ); ?>" style="width:100%;" />
<small><?php echo sprintf( __( 'Encontre ícones no site do %s.', 'newstc' ), '<a href="https://fontawesome.com/icons" target="_blank">Font Awesome</a>' ); ?></small>
</p>
<p>
<label for="button_link"><?php esc_html_e( 'Link do Botão:', 'newstc' ); ?></label>
<input type="url" id="button_link" name="button_link" value="<?php echo esc_url( $link ); ?>" style="width:100%;" />
</p>
<?php
}
function newstc_save_quick_access_meta( $post_id ) {
if ( ! isset( $_POST['newstc_quick_access_nonce'] ) || ! wp_verify_nonce( $_POST['newstc_quick_access_nonce'], 'newstc_save_quick_access_meta' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
update_post_meta( $post_id, '_button_icon', sanitize_text_field( $_POST['button_icon'] ?? '' ) );
update_post_meta( $post_id, '_button_link', esc_url_raw( $_POST['button_link'] ?? '' ) );
}
add_action( 'save_post', 'newstc_save_quick_access_meta' );

100
header.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
/**
* The header for our theme
*
* @package NewSTC
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="site">
<a class="skip-link sr-only" href="#primary"><?php esc_html_e('Pular para o conteúdo', 'newstc'); ?></a>
<header id="masthead" class="site-header">
<div class="top-bar">
<div class="container">
<div class="top-bar-contact">
<?php
$phone = get_theme_mod('newstc_phone');
$email = get_theme_mod('newstc_email');
if ($phone) : ?>
<a href="tel:<?php echo esc_attr($phone); ?>">
<i class="fas fa-phone"></i>
<?php echo esc_html($phone); ?>
</a>
<?php endif;
if ($email) : ?>
<a href="mailto:<?php echo esc_attr($email); ?>">
<i class="fas fa-envelope"></i>
<?php echo esc_html($email); ?>
</a>
<?php endif; ?>
</div>
<div class="top-bar-social">
<?php
$social_links = array(
'facebook' => get_theme_mod('newstc_facebook'),
'twitter' => get_theme_mod('newstc_twitter'),
'instagram' => get_theme_mod('newstc_instagram'),
'linkedin' => get_theme_mod('newstc_linkedin')
);
foreach ($social_links as $platform => $url) {
if ($url) {
echo '<a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer">';
echo '<i class="fab fa-' . esc_attr($platform) . '"></i>';
echo '</a>';
}
}
?>
</div>
</div>
</div>
<div class="main-header">
<div class="container">
<div class="site-branding">
<?php
if (has_custom_logo()) {
the_custom_logo();
} else {
echo '<div class="site-title-wrap">';
echo '<h1 class="site-title"><a href="' . esc_url(home_url('/')) . '" rel="home">' . get_bloginfo('name') . '</a></h1>';
if (get_bloginfo('description')) {
echo '<p class="site-description">' . get_bloginfo('description') . '</p>';
}
echo '</div>';
}
?>
</div>
<nav id="site-navigation" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<i class="fas fa-bars"></i>
<span class="sr-only"><?php esc_html_e('Menu Principal', 'newstc'); ?></span>
</button>
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'menu_id' => 'primary-menu',
'container' => false,
'menu_class' => 'primary-menu',
'fallback_cb' => false
));
?>
</nav>
</div>
</div>
</header>

78
index.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
/**
* O template principal
*
* Este é o template mais genérico no WordPress e um dos
* dois arquivos obrigatórios para um tema (o outro é style.css).
*
* @package NewSTC
*/
get_header();
?>
<main id="primary" class="site-main">
<div class="container">
<div class="latest-news">
<h1 class="page-title">
<?php
if ( is_home() && ! is_front_page() ) :
single_post_title();
else :
esc_html_e( 'Últimas Notícias', 'newstc' );
endif;
?>
</h1>
<?php if ( have_posts() ) : ?>
<div class="news-grid">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('news-card'); ?>>
<div class="news-thumbnail">
<?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('medium'); ?>
</a>
<?php endif; ?>
</div>
<div class="news-content">
<header class="news-header">
<h2 class="news-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php newstc_post_meta(); ?>
</header>
<div class="news-excerpt">
<?php the_excerpt(); ?>
</div>
<footer class="news-footer">
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'newstc'); ?></a>
</footer>
</div>
</article>
<?php
endwhile;
?>
</div>
<?php
the_posts_pagination(
array(
'prev_text' => '<i class="fas fa-arrow-left"></i> ' . esc_html__( 'Anterior', 'newstc' ),
'next_text' => esc_html__( 'Próximo', 'newstc' ) . ' <i class="fas fa-arrow-right"></i>',
)
);
else :
?>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'newstc'); ?></p>
<?php
endif;
?>
</div>
</div>
</main><!-- #main -->
<?php
get_sidebar();
get_footer();

11
js/navigation.js Normal file
View File

@@ -0,0 +1,11 @@
/**
* Arquivo para gerenciar a navegação responsiva
*/
document.addEventListener('DOMContentLoaded', function() {
const menuToggle = document.querySelector('.menu-toggle');
const primaryMenu = document.querySelector('.primary-menu');
if (!menuToggle || !primaryMenu) return;
menuToggle.addEventListener('click', function() {
const expanded = menuToggle.getAttribute('aria-expanded') === 'true' || false;

1360
modelo.html Normal file

File diff suppressed because it is too large Load Diff

34
page.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/**
* O template para exibir todas as páginas
*
* @package NewSTC
*/
get_header();
?>
<main id="primary" class="site-main">
<div class="container" style="padding-top: var(--spacing-xl); padding-bottom: var(--spacing-xl);">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('page-content'); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
<?php
endwhile; // Fim do loop.
?>
</div>
</main><!-- #main -->
<?php
get_footer();

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

17
sidebar.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
/**
* O arquivo da barra lateral
*
* @package NewSTC
*/
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<aside id="secondary" class="sidebar">
<div class="container">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div>
</aside><!-- #secondary -->

81
single.php Normal file
View File

@@ -0,0 +1,81 @@
<?php
/**
* O template para exibir todos os posts individuais
*
* @package NewSTC
*/
get_header();
?>
<div class="single-post-container">
<main id="primary" class="site-main">
<?php
while ( have_posts() ) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-content-area'); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-featured-image">
<?php the_post_thumbnail('newstc-featured'); ?>
</div>
<?php endif; ?>
<div class="post-content-wrapper">
<header class="entry-header">
<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '" class="post-category">' . esc_html( $categories[0]->name ) . '</a>';
}
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php newstc_post_meta(); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php
// Se existem tags, exibe-as
if (has_tag()) :
?>
<div class="post-tags">
<span class="tags-label"><?php esc_html_e('Tags:', 'newstc'); ?></span>
<?php the_tags('', '', ''); ?>
</div>
<?php endif; ?>
<?php newstc_social_share(); ?>
</footer><!-- .entry-footer -->
</div>
</article><!-- #post-<?php the_ID(); ?> -->
<div class="post-navigation-container">
<?php
the_post_navigation(
array(
'prev_text' => '<span class="nav-subtitle"><i class="fas fa-arrow-left"></i> ' . esc_html__( 'Post Anterior', 'newstc' ) . '</span> <span class="nav-title">%title</span>',
'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Próximo Post', 'newstc' ) . ' <i class="fas fa-arrow-right"></i></span> <span class="nav-title">%title</span>',
)
);
?>
</div>
<?php
// Se os comentários estão abertos ou temos pelo menos um comentário, carregue o template de comentários.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php
endwhile; // Fim do loop.
?>
</main><!-- #main -->
</div>
<?php
get_footer();

1329
style.css Normal file

File diff suppressed because it is too large Load Diff