50 lines
2.0 KiB
PHP
50 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* Front-page project grid.
|
|
*
|
|
* @package Gustavo_Portfolio
|
|
*/
|
|
|
|
$gustavoo_project_limit = max( 1, min( 24, absint( gustavoo_portfolio_get_setting( 'projects_limit', 6 ) ) ) );
|
|
$gustavoo_projects = gustavoo_portfolio_get_home_projects( $gustavoo_project_limit );
|
|
$gustavoo_archive_url = esc_url_raw( (string) gustavoo_portfolio_get_setting( 'projects_archive_url' ) );
|
|
?>
|
|
|
|
<section id="projetos" class="section section--projects" aria-labelledby="projects-title">
|
|
<div class="site-shell">
|
|
<header class="section__header section__header--split">
|
|
<div>
|
|
<p class="eyebrow"><?php echo esc_html( gustavoo_portfolio_get_setting( 'projects_eyebrow' ) ); ?></p>
|
|
<h2 id="projects-title" class="section__title"><?php echo esc_html( gustavoo_portfolio_get_setting( 'projects_title' ) ); ?></h2>
|
|
</div>
|
|
<p class="section__description"><?php echo esc_html( gustavoo_portfolio_get_setting( 'projects_text' ) ); ?></p>
|
|
</header>
|
|
|
|
<?php if ( $gustavoo_projects ) : ?>
|
|
<div class="projects-grid">
|
|
<?php
|
|
global $post;
|
|
|
|
foreach ( $gustavoo_projects as $post ) {
|
|
setup_postdata( $post );
|
|
get_template_part( 'template-parts/global/project-card' );
|
|
}
|
|
|
|
wp_reset_postdata();
|
|
?>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="section__empty">
|
|
<p><?php esc_html_e( 'Novos projetos serão publicados aqui em breve.', 'gustavoo-portfolio' ); ?></p>
|
|
<?php if ( current_user_can( 'edit_posts' ) && post_type_exists( 'gso_project' ) ) : ?>
|
|
<a class="text-link" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=gso_project' ) ); ?>"><?php esc_html_e( 'Adicionar o primeiro projeto', 'gustavoo-portfolio' ); ?> <span aria-hidden="true">→</span></a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ( $gustavoo_archive_url ) : ?>
|
|
<p class="section__action"><a class="button button--secondary" href="<?php echo esc_url( $gustavoo_archive_url ); ?>"><?php esc_html_e( 'Ver todos os projetos', 'gustavoo-portfolio' ); ?> <span aria-hidden="true">→</span></a></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|