Skip to content

Instantly share code, notes, and snippets.

@garagemwp
Last active July 23, 2018 19:09
Show Gist options
  • Save garagemwp/cedfb8e246e6bd1d0e2cdd8a395a92c5 to your computer and use it in GitHub Desktop.
Save garagemwp/cedfb8e246e6bd1d0e2cdd8a395a92c5 to your computer and use it in GitHub Desktop.
Estrutura básica de um template de arquivo de um tema de WordPress
<?php
/*
Template de Arquivo
Este trecho de código faz parte do artigo: Template de Arquivo: Série Anatomia de um Tema do WordPress #3
Artigo URL: https://garagemwp.com.br/template-de-arquivo-tema-wordpress/
*/
?>
<?php get_header(); ?>
<div id="page" class="site">
<header>
<h1><?php wp_title( '' ); ?></h1>
</header>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<article <?php post_class(); ?>>
<?php the_title('<h2>','</h2>'); ?>
<p><?php echo get_the_date(); ?></p>
<p><?php the_category( ', ' ); ?></p>
<?php the_post_thumbnail( 'thumbnail' ); ?>
<?php the_excerpt(); ?>
<p><a href="<?php echo get_permalink(); ?>">Leia mais</a></p>
<p>
<?php
if ( comments_open() ) :
echo '<p>';
comments_popup_link( 'Nenhum comentário', '1 comentário', '% comentários', 'comments-link', '');
echo '</p>';
endif;
?>
</p>
</article>
<?php endwhile; ?>
<?php echo paginate_links(); ?>
<?php else : ?>
<p>Desculpe-nos, mas nenhum post foi encontrado!</p>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment