48 lines
1.7 KiB
PHP
48 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Front-page latest posts.
|
|
*
|
|
* @package Gustavo_Portfolio
|
|
*/
|
|
|
|
$gustavoo_blog_limit = max( 1, min( 12, absint( gustavoo_portfolio_get_setting( 'blog_limit', 4 ) ) ) );
|
|
$gustavoo_posts = new WP_Query(
|
|
array(
|
|
'post_type' => 'post',
|
|
'post_status' => 'publish',
|
|
'posts_per_page' => $gustavoo_blog_limit,
|
|
'ignore_sticky_posts' => true,
|
|
'no_found_rows' => true,
|
|
)
|
|
);
|
|
?>
|
|
|
|
<section id="blog" class="section section--posts" aria-labelledby="latest-posts-title">
|
|
<div class="site-shell">
|
|
<header class="section__header section__header--split">
|
|
<div>
|
|
<p class="eyebrow"><?php echo esc_html( gustavoo_portfolio_get_setting( 'blog_eyebrow' ) ); ?></p>
|
|
<h2 id="latest-posts-title" class="section__title"><?php echo esc_html( gustavoo_portfolio_get_setting( 'blog_title' ) ); ?></h2>
|
|
</div>
|
|
<p class="section__description"><?php echo esc_html( gustavoo_portfolio_get_setting( 'blog_text' ) ); ?></p>
|
|
</header>
|
|
|
|
<?php if ( $gustavoo_posts->have_posts() ) : ?>
|
|
<div class="posts-grid posts-grid--featured">
|
|
<?php
|
|
while ( $gustavoo_posts->have_posts() ) {
|
|
$gustavoo_posts->the_post();
|
|
get_template_part( 'template-parts/global/post-card' );
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<p class="section__action"><a class="button button--secondary" href="<?php echo esc_url( gustavoo_portfolio_get_blog_url() ); ?>"><?php esc_html_e( 'Explorar todos os artigos', 'gustavoo-portfolio' ); ?> <span aria-hidden="true">→</span></a></p>
|
|
<?php else : ?>
|
|
<div class="section__empty"><p><?php esc_html_e( 'O primeiro artigo está a caminho.', 'gustavoo-portfolio' ); ?></p></div>
|
|
<?php endif; ?>
|
|
|
|
<?php wp_reset_postdata(); ?>
|
|
</div>
|
|
</section>
|