Mudança de nome. NewsTC para Terra do Rei

This commit is contained in:
2025-09-21 01:57:36 -03:00
parent 4e68a81614
commit 5922a7b889
9 changed files with 213 additions and 205 deletions

View File

@@ -1,6 +1,6 @@
# NewSTC - Tema WordPress para Notícias Corporativas
# Terra do Rei - 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.
`Terra do Rei` é 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
@@ -37,7 +37,7 @@ 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.
O tema `Terra do Rei` 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.
@@ -80,6 +80,58 @@ Os botões de atalho na página inicial são gerenciados através de um tipo de
Você pode adicionar, editar ou remover quantos botões desejar.
#### Sugestões de Botões
Abaixo estão algumas sugestões de botões que podem ser criados para melhorar a experiência do usuário:
**1. Últimas Notícias**
* **Título:** `Últimas Notícias`
* **Descrição (Conteúdo):** `Fique por dentro de todas as novidades e comunicados importantes da empresa.`
* **Ícone:** `fas fa-newspaper`
* **Link:** `/blog` (ou a URL da sua página de notícias)
**2. Calendário de Eventos**
* **Título:** `Calendário de Eventos`
* **Descrição (Conteúdo):** `Não perca nenhum evento! Confira nossa agenda completa de workshops e confraternizações.`
* **Ícone:** `fas fa-calendar-alt`
* **Link:** `#calendar` (ou a URL da sua página de eventos)
**3. Nossa Equipe**
* **Título:** `Nossa Equipe`
* **Descrição (Conteúdo):** `Conheça os talentos que fazem parte da nossa história e impulsionam nosso sucesso.`
* **Ícone:** `fas fa-users`
* **Link:** `/equipe` (ou a URL da sua página de equipe)
**4. Quem Somos**
* **Título:** `Quem Somos`
* **Descrição (Conteúdo):** `Descubra nossa missão, visão e os valores que guiam cada passo do nosso projeto.`
* **Ícone:** `fas fa-info-circle`
* **Link:** `/sobre` (ou a URL da sua página "Sobre")
**5. Fale Conosco**
* **Título:** `Fale Conosco`
* **Descrição (Conteúdo):** `Precisa de ajuda ou tem alguma dúvida? Entre em contato com nossos canais de atendimento.`
* **Ícone:** `fas fa-headset`
* **Link:** `/contato` (ou a URL da sua página de contato)
**6. Documentos Importantes**
* **Título:** `Documentos Importantes`
* **Descrição (Conteúdo):** `Acesse rapidamente manuais, políticas internas e outros arquivos essenciais para o seu dia a dia.`
* **Ícone:** `fas fa-file-alt`
* **Link:** `/documentos` (ou a URL da sua biblioteca de arquivos)
**7. Carreiras**
* **Título:** `Carreiras`
* **Descrição (Conteúdo):** `Quer fazer parte do nosso time? Confira as oportunidades abertas e venha crescer conosco.`
* **Ícone:** `fas fa-briefcase`
* **Link:** `/carreiras` (ou a URL da sua página de vagas)
**8. Galeria de Fotos**
* **Título:** `Galeria de Fotos`
* **Descrição (Conteúdo):** `Relembre os melhores momentos dos nossos eventos, confraternizações e conquistas.`
* **Ícone:** `fas fa-images`
* **Link:** `/galeria` (ou a URL da sua galeria)
### 5. Widgets
O tema oferece 4 áreas de widgets:

View File

@@ -4,7 +4,7 @@
*
* Contém o fechamento do elemento #page e todo o conteúdo após isso.
*
* @package NewSTC
* @package TerraDoRei
*/
?>
@@ -37,7 +37,7 @@
<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'); ?>
&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. <?php esc_html_e('Todos os direitos reservados.', 'terradorei'); ?>
</div>
<div class="footer-menu">

View File

@@ -2,7 +2,7 @@
/**
* Template para a página inicial
*
* @package NewSTC
* @package TerraDoRei
*/
get_header();
@@ -20,16 +20,16 @@ get_header();
<?php if ($hero_bg_image) : ?><div class="hero-overlay"></div><?php endif; ?>
<div class="container">
<div class="hero-content">
<h1><?php echo esc_html(get_theme_mod('hero_title', __('Notícias Corporativas', 'newstc'))); ?></h1>
<p><?php echo wp_kses_post(get_theme_mod('hero_description', __('Mantenha-se atualizado com as últimas notícias e informações da empresa', 'newstc'))); ?></p>
<h1><?php echo esc_html(get_theme_mod('hero_title', __('Notícias Corporativas', 'terradorei'))); ?></h1>
<p><?php echo wp_kses_post(get_theme_mod('hero_description', __('Mantenha-se atualizado com as últimas notícias e informações da empresa', 'terradorei'))); ?></p>
<div class="hero-cta">
<a href="<?php echo esc_url(get_theme_mod('hero_button_primary_link', get_permalink(get_option('page_for_posts')))); ?>" class="btn btn-white">
<i class="fas fa-newspaper"></i>
<?php echo esc_html(get_theme_mod('hero_button_primary_text', __('Ver Notícias', 'newstc'))); ?>
<?php echo esc_html(get_theme_mod('hero_button_primary_text', __('Ver Notícias', 'terradorei'))); ?>
</a>
<a href="<?php echo esc_url(get_theme_mod('hero_button_secondary_link', '#')); ?>" class="btn btn-secondary">
<i class="fas fa-info-circle"></i>
<?php echo esc_html(get_theme_mod('hero_button_secondary_text', __('Saiba Mais', 'newstc'))); ?>
<?php echo esc_html(get_theme_mod('hero_button_secondary_text', __('Saiba Mais', 'terradorei'))); ?>
</a>
</div>
</div>
@@ -70,7 +70,7 @@ get_header();
<section class="featured-news">
<div class="container">
<h2 class="section-title"><?php esc_html_e('Notícias em Destaque', 'newstc'); ?></h2>
<h2 class="section-title"><?php esc_html_e('Notícias em Destaque', 'terradorei'); ?></h2>
<div class="featured-news-container">
<div class="news-main">
@@ -94,18 +94,18 @@ get_header();
<?php the_post_thumbnail('large'); ?>
</a>
<?php endif; ?>
<div class="featured-badge"><?php esc_html_e('Destaque', 'newstc'); ?></div>
<div class="featured-badge"><?php esc_html_e('Destaque', 'terradorei'); ?></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(); ?>
<?php terradorei_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>
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'terradorei'); ?></a>
</footer>
</div>
</article>
@@ -114,7 +114,7 @@ get_header();
wp_reset_postdata();
else :
?>
<p><?php esc_html_e('Nenhuma notícia em destaque encontrada.', 'newstc'); ?></p>
<p><?php esc_html_e('Nenhuma notícia em destaque encontrada.', 'terradorei'); ?></p>
<?php
endif;
?>
@@ -140,7 +140,7 @@ get_header();
<section class="latest-news">
<div class="container">
<h2 class="section-title"><?php esc_html_e('Últimas Notícias', 'newstc'); ?></h2>
<h2 class="section-title"><?php esc_html_e('Últimas Notícias', 'terradorei'); ?></h2>
<div class="news-grid">
<?php
$latest_args = array(
@@ -164,13 +164,13 @@ get_header();
<div class="news-content">
<header class="news-header">
<h3 class="news-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php newstc_post_meta(); ?>
<?php terradorei_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>
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'terradorei'); ?></a>
</footer>
</div>
</article>
@@ -179,13 +179,13 @@ get_header();
wp_reset_postdata();
else :
?>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'newstc'); ?></p>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'terradorei'); ?></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>
<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', 'terradorei'); ?></a>
</div>
</div>
</section>

View File

@@ -1,8 +1,8 @@
<?php
/**
* NewSTC functions and definitions
* Terra do Rei functions and definitions
*
* @package NewSTC
* @package TerraDoRei
*/
if (!defined('ABSPATH')) {
@@ -10,15 +10,15 @@ if (!defined('ABSPATH')) {
}
// 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());
define('TERRADOREI_VERSION', '1.0.0');
define('TERRADOREI_TEMPLATE_DIR', get_template_directory());
define('TERRADOREI_TEMPLATE_URI', get_template_directory_uri());
// Configuração do tema
if (!function_exists('newstc_setup')) :
function newstc_setup() {
if (!function_exists('terradorei_setup')) :
function terradorei_setup() {
// Suporte a traduções
load_theme_textdomain('newstc', NEWSTC_TEMPLATE_DIR . '/languages');
load_theme_textdomain('terradorei', TERRADOREI_TEMPLATE_DIR . '/languages');
// Suporte a tags do HTML5
add_theme_support('html5', array(
@@ -36,14 +36,14 @@ if (!function_exists('newstc_setup')) :
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);
add_image_size('terradorei-featured', 800, 500, true);
add_image_size('terradorei-card', 400, 250, true);
add_image_size('terradorei-thumbnail', 150, 150, true);
// Suporte a menus
register_nav_menus(array(
'primary' => __('Menu Principal', 'newstc'),
'footer' => __('Menu do Rodapé', 'newstc'),
'primary' => __('Menu Principal', 'terradorei'),
'footer' => __('Menu do Rodapé', 'terradorei'),
));
// Suporte a widgets
@@ -72,68 +72,68 @@ if (!function_exists('newstc_setup')) :
add_filter('use_default_gallery_style', '__return_false');
}
endif;
add_action('after_setup_theme', 'newstc_setup');
add_action('after_setup_theme', 'terradorei_setup');
// Enfileirar scripts e estilos
function newstc_scripts() {
function terradorei_scripts() {
// Estilo principal
wp_enqueue_style('newstc-style', get_stylesheet_uri(), array(), NEWSTC_VERSION);
wp_enqueue_style('terradorei-style', get_stylesheet_uri(), array(), TERRADOREI_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);
wp_enqueue_style('terradorei-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');
wp_enqueue_style('terradorei-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);
wp_enqueue_script('terradorei-script', TERRADOREI_TEMPLATE_URI . '/assets/js/main.js', array(), TERRADOREI_VERSION, true);
// Adiciona dados para scripts
wp_localize_script('newstc-script', 'newstc_ajax', array(
wp_localize_script('terradorei-script', 'terradorei_ajax', array(
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('newstc_nonce')
'nonce' => wp_create_nonce('terradorei_nonce')
));
}
add_action('wp_enqueue_scripts', 'newstc_scripts');
add_action('wp_enqueue_scripts', 'terradorei_scripts');
/**
* Adiciona opções ao Personalizador do WordPress.
*/
function newstc_customize_register( $wp_customize ) {
function terradorei_customize_register( $wp_customize ) {
// Seção Hero
$wp_customize->add_section('newstc_hero_section', array(
'title' => __('Seção Hero', 'newstc'),
'description' => __('Opções para a seção Hero na página inicial.', 'newstc'),
$wp_customize->add_section('terradorei_hero_section', array(
'title' => __('Seção Hero', 'terradorei'),
'description' => __('Opções para a seção Hero na página inicial.', 'terradorei'),
'priority' => 30,
));
// Título
$wp_customize->add_setting('hero_title', ['default' => __('Notícias Corporativas', 'newstc'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_title', ['label' => __('Título', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'text']);
$wp_customize->add_setting('hero_title', ['default' => __('Notícias Corporativas', 'terradorei'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_title', ['label' => __('Título', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'text']);
// Descrição
$wp_customize->add_setting('hero_description', ['default' => __('Mantenha-se atualizado com as últimas notícias e informações da empresa', 'newstc'), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_description', ['label' => __('Descrição', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'textarea']);
$wp_customize->add_setting('hero_description', ['default' => __('Mantenha-se atualizado com as últimas notícias e informações da empresa', 'terradorei'), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_description', ['label' => __('Descrição', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'textarea']);
// Imagem de Fundo
$wp_customize->add_setting('hero_background_image', ['default' => '', 'sanitize_callback' => 'esc_url_raw']);
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hero_background_image', ['label' => __('Imagem de Fundo', 'newstc'), 'section' => 'newstc_hero_section']));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hero_background_image', ['label' => __('Imagem de Fundo', 'terradorei'), 'section' => 'terradorei_hero_section']));
// Texto do Botão Primário
$wp_customize->add_setting('hero_button_primary_text', ['default' => __('Ver Notícias', 'newstc'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_button_primary_text', ['label' => __('Texto do Botão Primário', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'text']);
$wp_customize->add_setting('hero_button_primary_text', ['default' => __('Ver Notícias', 'terradorei'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_button_primary_text', ['label' => __('Texto do Botão Primário', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'text']);
// Link do Botão Primário
$wp_customize->add_setting('hero_button_primary_link', ['default' => '#', 'sanitize_callback' => 'esc_url_raw']);
$wp_customize->add_control('hero_button_primary_link', ['label' => __('Link do Botão Primário', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'url']);
$wp_customize->add_control('hero_button_primary_link', ['label' => __('Link do Botão Primário', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'url']);
// Texto do Botão Secundário
$wp_customize->add_setting('hero_button_secondary_text', ['default' => __('Saiba Mais', 'newstc'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_button_secondary_text', ['label' => __('Texto do Botão Secundário', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'text']);
$wp_customize->add_setting('hero_button_secondary_text', ['default' => __('Saiba Mais', 'terradorei'), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage']);
$wp_customize->add_control('hero_button_secondary_text', ['label' => __('Texto do Botão Secundário', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'text']);
// Link do Botão Secundário
$wp_customize->add_setting('hero_button_secondary_link', ['default' => '#', 'sanitize_callback' => 'esc_url_raw']);
$wp_customize->add_control('hero_button_secondary_link', ['label' => __('Link do Botão Secundário', 'newstc'), 'section' => 'newstc_hero_section', 'type' => 'url']);
$wp_customize->add_control('hero_button_secondary_link', ['label' => __('Link do Botão Secundário', 'terradorei'), 'section' => 'terradorei_hero_section', 'type' => 'url']);
// Habilitar Live Preview
$wp_customize->get_setting('hero_title')->transport = 'postMessage';
@@ -150,28 +150,28 @@ function newstc_customize_register( $wp_customize ) {
'render_callback' => function() { return get_theme_mod('hero_description'); },
]);
}
add_action('customize_register', 'newstc_customize_register');
add_action('customize_register', 'terradorei_customize_register');
/**
* Enfileira script para o live preview do Customizer.
*/
function newstc_customizer_live_preview() {
function terradorei_customizer_live_preview() {
wp_enqueue_script(
'newstc-customizer',
'terradorei-customizer',
get_template_directory_uri() . '/assets/js/customizer.js',
array('jquery', 'customize-preview'),
NEWSTC_VERSION,
TERRADOREI_VERSION,
true
);
}
add_action('customize_preview_init', 'newstc_customizer_live_preview');
add_action('customize_preview_init', 'terradorei_customizer_live_preview');
// Registrar áreas de widgets
function newstc_widgets_init() {
function terradorei_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar Principal', 'newstc'),
'name' => __('Sidebar Principal', 'terradorei'),
'id' => 'sidebar-1',
'description' => __('Widgets que aparecem na sidebar principal.', 'newstc'),
'description' => __('Widgets que aparecem na sidebar principal.', 'terradorei'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
@@ -179,9 +179,9 @@ function newstc_widgets_init() {
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 1', 'newstc'),
'name' => __('Rodapé - Coluna 1', 'terradorei'),
'id' => 'footer-1',
'description' => __('Widgets que aparecem na primeira coluna do rodapé.', 'newstc'),
'description' => __('Widgets que aparecem na primeira coluna do rodapé.', 'terradorei'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
@@ -189,9 +189,9 @@ function newstc_widgets_init() {
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 2', 'newstc'),
'name' => __('Rodapé - Coluna 2', 'terradorei'),
'id' => 'footer-2',
'description' => __('Widgets que aparecem na segunda coluna do rodapé.', 'newstc'),
'description' => __('Widgets que aparecem na segunda coluna do rodapé.', 'terradorei'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
@@ -199,20 +199,20 @@ function newstc_widgets_init() {
));
register_sidebar(array(
'name' => __('Rodapé - Coluna 3', 'newstc'),
'name' => __('Rodapé - Coluna 3', 'terradorei'),
'id' => 'footer-3',
'description' => __('Widgets que aparecem na terceira coluna do rodapé.', 'newstc'),
'description' => __('Widgets que aparecem na terceira coluna do rodapé.', 'terradorei'),
'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');
add_action('widgets_init', 'terradorei_widgets_init');
// Funções personalizadas
function newstc_post_meta() {
$reading_time = newstc_reading_time();
function terradorei_post_meta() {
$reading_time = terradorei_reading_time();
echo '<div class="post-meta">';
echo '<span class="post-date"><i class="far fa-calendar-alt"></i> ' . get_the_date() . '</span>';
@@ -220,66 +220,21 @@ function newstc_post_meta() {
echo '</div>';
}
function newstc_reading_time() {
function terradorei_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');
return __('Menos de 1 min de leitura', 'terradorei');
}
$time_string = sprintf(_n('%s min de leitura', '%s min de leitura', $reading_time, 'newstc'), $reading_time);
$time_string = sprintf(_n('%s min de leitura', '%s min de leitura', $reading_time, 'terradorei'), $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() {
function terradorei_social_share() {
$post_url = urlencode(get_permalink());
$post_title = urlencode(get_the_title());
@@ -292,7 +247,7 @@ function newstc_social_share() {
];
echo '<div class="post-share">';
echo '<span class="share-label">' . esc_html__('Compartilhar:', 'newstc') . '</span>';
echo '<span class="share-label">' . esc_html__('Compartilhar:', 'terradorei') . '</span>';
echo '<div class="share-buttons">';
foreach ($social_links as $platform => $link) {
@@ -302,14 +257,14 @@ function newstc_social_share() {
}
// Botão de Imprimir
echo '<button onclick="window.print()" class="share-btn print-btn" title="' . esc_attr__('Imprimir', 'newstc') . '">';
echo '<button onclick="window.print()" class="share-btn print-btn" title="' . esc_attr__('Imprimir', 'terradorei') . '">';
echo '<i class="fas fa-print"></i>';
echo '</button>';
echo '</div></div>';
}
// Shortcodes personalizados
function newstc_calendar_shortcode($atts) {
function terradorei_calendar_shortcode($atts) {
$atts = shortcode_atts(array(
'show_title' => true,
'show_navigation' => true
@@ -317,18 +272,18 @@ function newstc_calendar_shortcode($atts) {
ob_start();
?>
<div class="newstc-calendar">
<div class="terradorei-calendar">
<?php if ($atts['show_title']) : ?>
<h3><?php _e('Calendário de Eventos', 'newstc'); ?></h3>
<h3><?php _e('Calendário de Eventos', 'terradorei'); ?></h3>
<?php endif; ?>
<?php echo do_shortcode('[mostra-calendario-widget]'); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('newstc_calendar', 'newstc_calendar_shortcode');
add_shortcode('terradorei_calendar', 'terradorei_calendar_shortcode');
function newstc_events_shortcode($atts) {
function terradorei_events_shortcode($atts) {
$atts = shortcode_atts(array(
'limit' => 5,
'show_title' => true
@@ -336,37 +291,37 @@ function newstc_events_shortcode($atts) {
ob_start();
?>
<div class="newstc-events">
<div class="terradorei-events">
<?php if ($atts['show_title']) : ?>
<h3><?php _e('Próximos Eventos', 'newstc'); ?></h3>
<h3><?php _e('Próximos Eventos', 'terradorei'); ?></h3>
<?php endif; ?>
<?php echo do_shortcode('[mostra-prox-eventos]'); ?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('newstc_events', 'newstc_events_shortcode');
add_shortcode('terradorei_events', 'terradorei_events_shortcode');
// Otimizações e funcionalidades adicionais
function newstc_excerpt_length($length) {
function terradorei_excerpt_length($length) {
return 25;
}
add_filter('excerpt_length', 'newstc_excerpt_length');
add_filter('excerpt_length', 'terradorei_excerpt_length');
function newstc_excerpt_more($more) {
function terradorei_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'newstc_excerpt_more');
add_filter('excerpt_more', 'terradorei_excerpt_more');
// Suporte a SVG
function newstc_svg_support($mimes) {
function terradorei_svg_support($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'newstc_svg_support');
add_filter('upload_mimes', 'terradorei_svg_support');
// Remover emojis do WordPress (para melhor performance)
function newstc_disable_emojis() {
function terradorei_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');
@@ -375,36 +330,36 @@ function newstc_disable_emojis() {
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
}
add_action('init', 'newstc_disable_emojis');
add_action('init', 'terradorei_disable_emojis');
// Otimizar consultas do WordPress
function newstc_optimize_queries($query) {
function terradorei_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');
add_action('pre_get_posts', 'terradorei_optimize_queries');
// Adicionar suporte a WebP
function newstc_webp_support($mimes) {
function terradorei_webp_support($mimes) {
$mimes['webp'] = 'image/webp';
return $mimes;
}
add_filter('mime_types', 'newstc_webp_support');
add_filter('mime_types', 'terradorei_webp_support');
// Customizar a pesquisa
function newstc_search_filter($query) {
function terradorei_search_filter($query) {
if ($query->is_search && !is_admin()) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts', 'newstc_search_filter');
add_filter('pre_get_posts', 'terradorei_search_filter');
// Adicionar suporte a lazy loading para imagens
function newstc_lazy_load_images($content) {
function terradorei_lazy_load_images($content) {
if (is_feed() || is_admin()) {
return $content;
}
@@ -425,10 +380,10 @@ function newstc_lazy_load_images($content) {
return $content;
}
add_filter('the_content', 'newstc_lazy_load_images');
add_filter('the_content', 'terradorei_lazy_load_images');
// Adicionar schema markup para melhor SEO
function newstc_schema_markup() {
function terradorei_schema_markup() {
if (is_single()) {
$schema = array(
'@context' => 'https://schema.org',
@@ -462,33 +417,33 @@ function newstc_schema_markup() {
echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
}
}
add_action('wp_head', 'newstc_schema_markup');
add_action('wp_head', 'terradorei_schema_markup');
/**
* Custom Post Type para Botões de Acesso Rápido.
*/
function newstc_register_quick_access_cpt() {
function terradorei_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' ),
'name' => _x( 'Botões de Acesso Rápido', 'Post Type General Name', 'terradorei' ),
'singular_name' => _x( 'Botão de Acesso Rápido', 'Post Type Singular Name', 'terradorei' ),
'menu_name' => __( 'Acesso Rápido', 'terradorei' ),
'name_admin_bar' => __( 'Botão de Acesso Rápido', 'terradorei' ),
'archives' => __( 'Arquivos de Botões', 'terradorei' ),
'attributes' => __( 'Atributos do Botão', 'terradorei' ),
'parent_item_colon' => __( 'Botão Pai:', 'terradorei' ),
'all_items' => __( 'Todos os Botões', 'terradorei' ),
'add_new_item' => __( 'Adicionar Novo Botão', 'terradorei' ),
'add_new' => __( 'Adicionar Novo', 'terradorei' ),
'new_item' => __( 'Novo Botão', 'terradorei' ),
'edit_item' => __( 'Editar Botão', 'terradorei' ),
'update_item' => __( 'Atualizar Botão', 'terradorei' ),
'view_item' => __( 'Ver Botão', 'terradorei' ),
'view_items' => __( 'Ver Botões', 'terradorei' ),
'search_items' => __( 'Procurar Botão', 'terradorei' ),
);
$args = array(
'label' => __( 'Botão de Acesso Rápido', 'newstc' ),
'description' => __( 'Botões para a seção de acesso rápido na home.', 'newstc' ),
'label' => __( 'Botão de Acesso Rápido', 'terradorei' ),
'description' => __( 'Botões para a seção de acesso rápido na home.', 'terradorei' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'page-attributes' ),
'hierarchical' => false,
@@ -507,35 +462,35 @@ function newstc_register_quick_access_cpt() {
);
register_post_type( 'quick_access_button', $args );
}
add_action( 'init', 'newstc_register_quick_access_cpt', 0 );
add_action( 'init', 'terradorei_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' );
function terradorei_quick_access_meta_box() {
add_meta_box( 'quick_access_details', __( 'Detalhes do Botão', 'terradorei' ), 'terradorei_quick_access_meta_box_callback', 'quick_access_button' );
}
add_action( 'add_meta_boxes', 'newstc_quick_access_meta_box' );
add_action( 'add_meta_boxes', 'terradorei_quick_access_meta_box' );
function newstc_quick_access_meta_box_callback( $post ) {
wp_nonce_field( 'newstc_save_quick_access_meta', 'newstc_quick_access_nonce' );
function terradorei_quick_access_meta_box_callback( $post ) {
wp_nonce_field( 'terradorei_save_quick_access_meta', 'terradorei_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>
<label for="button_icon"><?php esc_html_e( 'Ícone (ex: fas fa-newspaper):', 'terradorei' ); ?></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>
<small><?php echo sprintf( __( 'Encontre ícones no site do %s.', 'terradorei' ), '<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>
<label for="button_link"><?php esc_html_e( 'Link do Botão:', 'terradorei' ); ?></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' ) ) {
function terradorei_save_quick_access_meta( $post_id ) {
if ( ! isset( $_POST['terradorei_quick_access_nonce'] ) || ! wp_verify_nonce( $_POST['terradorei_quick_access_nonce'], 'terradorei_save_quick_access_meta' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
@@ -547,13 +502,13 @@ function newstc_save_quick_access_meta( $post_id ) {
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' );
add_action( 'save_post', 'terradorei_save_quick_access_meta' );
/**
* Configura as páginas padrão na ativação do tema.
* Cria as páginas 'Início' e 'Blog' e as define nas configurações de leitura.
*/
function newstc_setup_default_pages() {
function terradorei_setup_default_pages() {
// Verifica se a página 'Início' já existe
$home_page = get_page_by_title( 'Início' );
@@ -595,4 +550,4 @@ function newstc_setup_default_pages() {
update_option( 'page_for_posts', $blog_page_id );
}
}
add_action( 'after_switch_theme', 'newstc_setup_default_pages' );
add_action( 'after_switch_theme', 'terradorei_setup_default_pages' );

View File

@@ -5,7 +5,7 @@
* Este é o template mais genérico no WordPress e um dos
* dois arquivos obrigatórios para um tema (o outro é style.css).
*
* @package NewSTC
* @package TerraDoRei
*/
get_header();
@@ -19,7 +19,7 @@ get_header();
if ( is_home() && ! is_front_page() ) :
single_post_title();
else :
esc_html_e( 'Últimas Notícias', 'newstc' );
esc_html_e( 'Últimas Notícias', 'terradorei' );
endif;
?>
</h1>
@@ -35,20 +35,20 @@ get_header();
<div class="news-thumbnail">
<?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('newstc-card'); ?>
<?php the_post_thumbnail('terradorei-card'); ?>
</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(); ?>
<?php terradorei_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>
<a href="<?php the_permalink(); ?>" class="btn btn-primary"><?php esc_html_e('Leia mais', 'terradorei'); ?></a>
</footer>
</div>
</article>
@@ -60,13 +60,13 @@ get_header();
<?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>',
'prev_text' => '<i class="fas fa-arrow-left"></i> ' . esc_html__( 'Anterior', 'terradorei' ),
'next_text' => esc_html__( 'Próximo', 'terradorei' ) . ' <i class="fas fa-arrow-right"></i>',
)
);
else :
?>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'newstc'); ?></p>
<p><?php esc_html_e('Nenhuma notícia encontrada.', 'terradorei'); ?></p>
<?php
endif;
?>

View File

@@ -2,7 +2,7 @@
/**
* O template para exibir todas as páginas
*
* @package NewSTC
* @package TerraDoRei
*/
get_header();

View File

@@ -2,7 +2,7 @@
/**
* O template para exibir todos os posts individuais
*
* @package NewSTC
* @package TerraDoRei
*/
get_header();
@@ -18,7 +18,7 @@ get_header();
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-featured-image">
<?php the_post_thumbnail('newstc-featured'); ?>
<?php the_post_thumbnail('terradorei-featured'); ?>
</div>
<?php endif; ?>
@@ -31,7 +31,7 @@ get_header();
}
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php newstc_post_meta(); ?>
<?php terradorei_post_meta(); ?>
</header><!-- .entry-header -->
<div class="entry-content">
@@ -44,12 +44,12 @@ get_header();
if (has_tag()) :
?>
<div class="post-tags">
<span class="tags-label"><?php esc_html_e('Tags:', 'newstc'); ?></span>
<span class="tags-label"><?php esc_html_e('Tags:', 'terradorei'); ?></span>
<?php the_tags('', '', ''); ?>
</div>
<?php endif; ?>
<?php newstc_social_share(); ?>
<?php terradorei_social_share(); ?>
</footer><!-- .entry-footer -->
</div>
</article><!-- #post-<?php the_ID(); ?> -->
@@ -58,8 +58,8 @@ get_header();
<?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>',
'prev_text' => '<span class="nav-subtitle"><i class="fas fa-arrow-left"></i> ' . esc_html__( 'Post Anterior', 'terradorei' ) . '</span> <span class="nav-title">%title</span>',
'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Próximo Post', 'terradorei' ) . ' <i class="fas fa-arrow-right"></i></span> <span class="nav-title">%title</span>',
)
);
?>

View File

@@ -1,13 +1,13 @@
/*
Theme Name: NewSTC
Theme URI: https://exemplo.com/newstc
Theme Name: Terra do Rei
Theme URI: https://exemplo.com/terradorei
Author: Marco Antonio Vivas
Author URI: https://marcovivas.com/
Description: Um tema moderno para sites de notícias corporativas com design responsivo e funcionalidades avançadas.
Description: Um tema moderno para portais de notícias, intranets e sites de comunicação interna, com design responsivo e funcionalidades avançadas.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: newstc
Text Domain: terradorei
Tags: notícias, corporativo, responsivo, moderno
*/

View File

@@ -5,7 +5,8 @@
* Este é o template para páginas que precisam ocupar a largura total da tela,
* sem o container padrão.
*
* @package NewSTC
* @package TerraDoRei
*/
get_header();