Mini Shell
<?php
/*
Template Name: Página de Notícias
*/
get_header(); ?>
<main id="news" class="section-news">
<div class="container">
<?php /* <?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 6,
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
$count = 0; // contador de posts
while ( $query->have_posts() ) {
$query->the_post();
$count++;
// Abre <div class="row"> a cada 3 posts
if ( $count % 3 === 1 ) {
echo '<div class="row">';
}
// Aqui você pode personalizar a exibição de cada post
// por exemplo, usando as funções the_title(), the_content(), etc.
echo '<div class="col-md-4">';
if ( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'500x311', true);
echo '<img src="' . $thumb_url[0] . '" class="img-fluid" />';
}
echo '<h2>' . get_the_title() . '</h2>';
echo '<p>' . get_the_excerpt() . '</p>';
echo '</div>';
// Fecha <div class="row"> a cada 3 posts
if ( $count % 3 === 0 || $count === $query->post_count ) {
echo '</div>';
}
}
wp_reset_postdata(); // redefinir dados do post
} else {
// Caso não haja posts
echo 'Nenhum post encontrado.';
}
?> */ ?>
<div id="content" class="row site-content">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
?>
<?php
// Adicione a navegação de Infinite Scroll
// the_posts_pagination( array(
// 'mid_size' => 2,
// 'prev_text' => __( 'Anterior', 'textdomain' ),
// 'next_text' => __( 'Próximo', 'textdomain' ),
// ) );
?>
</div>
</div>
</main><!-- #main -->
<style>
@media(min-width:768px){
#principal-header.inner-header {
padding-bottom:2rem;
}
#news::before {
margin-bottom:5rem;
}
}
</style>
<?php
get_footer();
?>
Zerion Mini Shell 1.0