Criação da página FULL
This commit is contained in:
@@ -164,10 +164,7 @@ get_header();
|
|||||||
<div class="news-content">
|
<div class="news-content">
|
||||||
<header class="news-header">
|
<header class="news-header">
|
||||||
<h3 class="news-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
|
<h3 class="news-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
|
||||||
<div class="news-meta">
|
<?php newstc_post_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>
|
</header>
|
||||||
<div class="news-excerpt">
|
<div class="news-excerpt">
|
||||||
<?php the_excerpt(); ?>
|
<?php the_excerpt(); ?>
|
||||||
|
@@ -548,3 +548,51 @@ function newstc_save_quick_access_meta( $post_id ) {
|
|||||||
update_post_meta( $post_id, '_button_link', esc_url_raw( $_POST['button_link'] ?? '' ) );
|
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', 'newstc_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() {
|
||||||
|
// Verifica se a página 'Início' já existe
|
||||||
|
$home_page = get_page_by_title( 'Início' );
|
||||||
|
|
||||||
|
if ( ! $home_page ) {
|
||||||
|
$home_page_id = wp_insert_post( array(
|
||||||
|
'post_title' => 'Início',
|
||||||
|
'post_content' => '<!-- wp:paragraph -->Esta é a sua página inicial. Edite-a para adicionar seu próprio conteúdo.<!-- /wp:paragraph -->',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'post_author' => 1,
|
||||||
|
'post_type' => 'page',
|
||||||
|
'comment_status' => 'closed',
|
||||||
|
'ping_status' => 'closed',
|
||||||
|
) );
|
||||||
|
} else {
|
||||||
|
$home_page_id = $home_page->ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica se a página 'Blog' já existe
|
||||||
|
$blog_page = get_page_by_title( 'Blog' );
|
||||||
|
|
||||||
|
if ( ! $blog_page ) {
|
||||||
|
$blog_page_id = wp_insert_post( array(
|
||||||
|
'post_title' => 'Blog',
|
||||||
|
'post_content' => '<!-- wp:paragraph -->Esta página exibirá suas últimas notícias.<!-- /wp:paragraph -->',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'post_author' => 1,
|
||||||
|
'post_type' => 'page',
|
||||||
|
'comment_status' => 'closed',
|
||||||
|
'ping_status' => 'closed',
|
||||||
|
) );
|
||||||
|
} else {
|
||||||
|
$blog_page_id = $blog_page->ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define as páginas nas configurações de Leitura do WordPress
|
||||||
|
if ( isset( $home_page_id ) && isset( $blog_page_id ) ) {
|
||||||
|
update_option( 'show_on_front', 'page' );
|
||||||
|
update_option( 'page_on_front', $home_page_id );
|
||||||
|
update_option( 'page_for_posts', $blog_page_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'after_switch_theme', 'newstc_setup_default_pages' );
|
35
template-full-width.php
Normal file
35
template-full-width.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Template Name: Página com Largura Total
|
||||||
|
*
|
||||||
|
* Este é o template para páginas que precisam ocupar a largura total da tela,
|
||||||
|
* sem o container padrão.
|
||||||
|
*
|
||||||
|
* @package NewSTC
|
||||||
|
*/
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main id="primary" class="site-main">
|
||||||
|
<?php
|
||||||
|
while ( have_posts() ) :
|
||||||
|
the_post();
|
||||||
|
?>
|
||||||
|
<article id="post-<?php the_ID(); ?>" <?php post_class('page-content-full-width'); ?>>
|
||||||
|
<header class="entry-header" style="padding: var(--spacing-xl) var(--spacing-lg) 0;">
|
||||||
|
<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.
|
||||||
|
?>
|
||||||
|
</main><!-- #main -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
Reference in New Issue
Block a user