Initial commit: gustavoo portfolio project
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/** Compact editorial news card. @package Gustavo_Portfolio */
|
||||
|
||||
$gustavoo_args = isset( $args ) && is_array( $args ) ? $args : array();
|
||||
$gustavoo_is_featured = ! empty( $gustavoo_args['featured'] );
|
||||
$gustavoo_categories = get_the_category();
|
||||
$gustavoo_category = $gustavoo_categories ? $gustavoo_categories[0] : null;
|
||||
$gustavoo_image_url = gustavoo_portfolio_get_news_image_url( get_the_ID(), $gustavoo_is_featured ? 'large' : 'gustavoo-post-card' );
|
||||
?>
|
||||
<article <?php post_class( 'latest-news-card' . ( $gustavoo_is_featured ? ' latest-news-card--featured' : '' ) ); ?>>
|
||||
<a class="latest-news-card__media" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
|
||||
<?php if ( $gustavoo_image_url ) : ?>
|
||||
<img class="latest-news-card__image" src="<?php echo esc_url( $gustavoo_image_url ); ?>" loading="<?php echo $gustavoo_is_featured ? 'eager' : 'lazy'; ?>" decoding="async" alt="">
|
||||
<?php else : ?><span class="latest-news-card__placeholder" aria-hidden="true"></span><?php endif; ?>
|
||||
</a>
|
||||
<div class="latest-news-card__body">
|
||||
<?php if ( $gustavoo_category ) : ?><a class="latest-news-card__category" href="<?php echo esc_url( get_category_link( $gustavoo_category ) ); ?>"><?php echo esc_html( $gustavoo_category->name ); ?></a><?php endif; ?>
|
||||
<h2 class="latest-news-card__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<time class="latest-news-card__date" datetime="<?php echo esc_attr( get_the_date( DATE_W3C ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
|
||||
<?php if ( $gustavoo_is_featured && has_excerpt() ) : ?><p class="latest-news-card__excerpt"><?php echo esc_html( wp_trim_words( get_the_excerpt(), 28 ) ); ?></p><?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Secondary compact news list for news and category pages.
|
||||
*
|
||||
* @package Gustavo_Portfolio
|
||||
*/
|
||||
|
||||
$gustavoo_args = isset( $args ) && is_array( $args ) ? $args : array();
|
||||
$gustavoo_query_args = array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 4,
|
||||
'post__not_in' => array_map( 'absint', $gustavoo_args['exclude'] ?? array() ),
|
||||
'ignore_sticky_posts' => true,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
);
|
||||
|
||||
if ( ! empty( $gustavoo_args['category_id'] ) ) {
|
||||
$gustavoo_query_args['cat'] = absint( $gustavoo_args['category_id'] );
|
||||
}
|
||||
|
||||
$gustavoo_latest_posts = new WP_Query( $gustavoo_query_args );
|
||||
|
||||
if ( ! $gustavoo_latest_posts->have_posts() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<section class="latest-news-list" aria-labelledby="latest-news-list-title">
|
||||
<h2 id="latest-news-list-title" class="latest-news-list__heading"><?php esc_html_e( 'Últimas notícias', 'gustavoo-portfolio' ); ?></h2>
|
||||
<div class="latest-news-list__items">
|
||||
<?php while ( $gustavoo_latest_posts->have_posts() ) : $gustavoo_latest_posts->the_post(); ?>
|
||||
<?php $gustavoo_categories = get_the_category(); $gustavoo_category = $gustavoo_categories ? $gustavoo_categories[0] : null; $gustavoo_image_url = gustavoo_portfolio_get_news_image_url(); ?>
|
||||
<article <?php post_class( 'latest-news-list__item' ); ?>>
|
||||
<a class="latest-news-list__image" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
|
||||
<?php if ( $gustavoo_image_url ) : ?><img src="<?php echo esc_url( $gustavoo_image_url ); ?>" loading="lazy" decoding="async" alt=""><?php endif; ?>
|
||||
</a>
|
||||
<div class="latest-news-list__body">
|
||||
<?php if ( $gustavoo_category ) : ?><a class="latest-news-card__category" href="<?php echo esc_url( get_category_link( $gustavoo_category ) ); ?>"><?php echo esc_html( $gustavoo_category->name ); ?></a><?php endif; ?>
|
||||
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
|
||||
<time datetime="<?php echo esc_attr( get_the_date( DATE_W3C ) ); ?>"><?php echo esc_html( get_the_date( 'D, d/m/Y · H:i' ) ); ?></time>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Global newsletter call to action, rendered before every site footer.
|
||||
*
|
||||
* @package Gustavo_Portfolio
|
||||
*/
|
||||
|
||||
$gustavoo_newsletter_form_id = absint( gustavoo_portfolio_get_setting( 'newsletter_form_id' ) );
|
||||
$gustavoo_privacy_url = get_privacy_policy_url();
|
||||
?>
|
||||
|
||||
<section class="section section--newsletter" aria-labelledby="newsletter-title">
|
||||
<div class="site-shell newsletter-panel">
|
||||
<div class="newsletter-panel__content">
|
||||
<p class="eyebrow"><?php echo esc_html( gustavoo_portfolio_get_setting( 'newsletter_eyebrow' ) ); ?></p>
|
||||
<h2 id="newsletter-title" class="newsletter-panel__title"><?php echo esc_html( gustavoo_portfolio_get_setting( 'newsletter_heading' ) ); ?></h2>
|
||||
<p class="newsletter-panel__description"><?php echo esc_html( gustavoo_portfolio_get_setting( 'newsletter_text' ) ); ?></p>
|
||||
</div>
|
||||
|
||||
<div class="newsletter-panel__form">
|
||||
<?php gustavoo_portfolio_the_fluent_form( $gustavoo_newsletter_form_id, 'newsletter' ); ?>
|
||||
<?php if ( $gustavoo_privacy_url ) : ?>
|
||||
<p class="form-privacy">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: privacy policy URL. */
|
||||
wp_kses_post( __( 'Você pode cancelar a inscrição a qualquer momento. Consulte a <a href="%s">Política de Privacidade</a>.', 'gustavoo-portfolio' ) ),
|
||||
esc_url( $gustavoo_privacy_url )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Blog post card.
|
||||
*
|
||||
* @package Gustavo_Portfolio
|
||||
*/
|
||||
|
||||
$gustavoo_categories = get_the_category();
|
||||
$gustavoo_category = $gustavoo_categories ? $gustavoo_categories[0] : null;
|
||||
?>
|
||||
|
||||
<article <?php post_class( 'post-card' ); ?>>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<a class="post-card__media" href="<?php the_permalink(); ?>" tabindex="-1" aria-hidden="true">
|
||||
<?php
|
||||
the_post_thumbnail(
|
||||
'gustavoo-post-card',
|
||||
array(
|
||||
'class' => 'post-card__image',
|
||||
'loading' => 'lazy',
|
||||
'decoding' => 'async',
|
||||
'alt' => '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="post-card__body">
|
||||
<div class="post-card__meta">
|
||||
<?php if ( $gustavoo_category ) : ?>
|
||||
<a class="post-card__category" href="<?php echo esc_url( get_category_link( $gustavoo_category ) ); ?>"><?php echo esc_html( $gustavoo_category->name ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php gustavoo_portfolio_posted_on(); ?>
|
||||
<span class="reading-time"><?php echo esc_html( gustavoo_portfolio_reading_time() ); ?></span>
|
||||
</div>
|
||||
|
||||
<h2 class="post-card__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
<p class="post-card__excerpt"><?php echo esc_html( wp_trim_words( get_the_excerpt(), 26 ) ); ?></p>
|
||||
<a class="post-card__more" href="<?php the_permalink(); ?>">
|
||||
<?php esc_html_e( 'Ler artigo', 'gustavoo-portfolio' ); ?> <span aria-hidden="true">→</span>
|
||||
<span class="screen-reader-text">: <?php the_title(); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Project card.
|
||||
*
|
||||
* @package Gustavo_Portfolio
|
||||
*/
|
||||
|
||||
$gustavoo_project_id = get_the_ID();
|
||||
$gustavoo_project_url = gustavoo_portfolio_validate_project_url( get_post_meta( $gustavoo_project_id, '_gso_project_url', true ) );
|
||||
$gustavoo_project_client = sanitize_text_field( (string) get_post_meta( $gustavoo_project_id, '_gso_project_client', true ) );
|
||||
$gustavoo_project_year = absint( get_post_meta( $gustavoo_project_id, '_gso_project_year', true ) );
|
||||
$gustavoo_project_link_label = sanitize_text_field( (string) get_post_meta( $gustavoo_project_id, '_gso_project_link_label', true ) );
|
||||
$gustavoo_project_link_label = $gustavoo_project_link_label ?: __( 'Ver projeto', 'gustavoo-portfolio' );
|
||||
$gustavoo_project_types = taxonomy_exists( 'gso_project_type' ) ? get_the_terms( $gustavoo_project_id, 'gso_project_type' ) : array();
|
||||
$gustavoo_project_tech = taxonomy_exists( 'gso_project_tech' ) ? get_the_terms( $gustavoo_project_id, 'gso_project_tech' ) : array();
|
||||
|
||||
if ( ! $gustavoo_project_url ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<article <?php post_class( 'project-card' ); ?>>
|
||||
<a class="project-card__link" href="<?php echo esc_url( $gustavoo_project_url ); ?>" target="_blank" rel="noopener noreferrer external">
|
||||
<figure class="project-card__media">
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<?php
|
||||
$gustavoo_thumbnail_id = get_post_thumbnail_id();
|
||||
$gustavoo_thumbnail_alt = get_post_meta( $gustavoo_thumbnail_id, '_wp_attachment_image_alt', true );
|
||||
$gustavoo_thumbnail_alt = $gustavoo_thumbnail_alt ?: sprintf(
|
||||
/* translators: %s: project title. */
|
||||
__( 'Imagem do projeto %s', 'gustavoo-portfolio' ),
|
||||
get_the_title()
|
||||
);
|
||||
|
||||
echo get_the_post_thumbnail(
|
||||
$gustavoo_project_id,
|
||||
'gustavoo-project-card',
|
||||
array(
|
||||
'alt' => $gustavoo_thumbnail_alt,
|
||||
'class' => 'project-card__image',
|
||||
'loading' => 'lazy',
|
||||
'decoding' => 'async',
|
||||
)
|
||||
); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core image markup.
|
||||
?>
|
||||
<?php else : ?>
|
||||
<span class="project-card__placeholder" aria-hidden="true">
|
||||
<img src="<?php echo esc_url( gustavoo_portfolio_get_image_source( 'logo-mark' ) ); ?>" width="96" height="96" alt="">
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
|
||||
<div class="project-card__body">
|
||||
<?php if ( ! is_wp_error( $gustavoo_project_types ) && $gustavoo_project_types ) : ?>
|
||||
<p class="project-card__type"><?php echo esc_html( implode( ' · ', wp_list_pluck( $gustavoo_project_types, 'name' ) ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="project-card__title"><?php the_title(); ?></h3>
|
||||
|
||||
<?php if ( has_excerpt() ) : ?>
|
||||
<p class="project-card__description"><?php echo esc_html( wp_trim_words( get_the_excerpt(), 24 ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $gustavoo_project_client || $gustavoo_project_year ) : ?>
|
||||
<p class="project-card__meta">
|
||||
<?php echo esc_html( implode( ' · ', array_filter( array( $gustavoo_project_client, $gustavoo_project_year ? (string) $gustavoo_project_year : '' ) ) ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! is_wp_error( $gustavoo_project_tech ) && $gustavoo_project_tech ) : ?>
|
||||
<ul class="project-card__tags" aria-label="<?php esc_attr_e( 'Tecnologias', 'gustavoo-portfolio' ); ?>">
|
||||
<?php foreach ( array_slice( $gustavoo_project_tech, 0, 4 ) as $gustavoo_technology ) : ?>
|
||||
<li><?php echo esc_html( $gustavoo_technology->name ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<span class="project-card__cta">
|
||||
<?php echo esc_html( $gustavoo_project_link_label ); ?> <span aria-hidden="true">↗</span>
|
||||
<span class="screen-reader-text"> <?php esc_html_e( '(abre em uma nova guia)', 'gustavoo-portfolio' ); ?></span>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Floating WhatsApp action used by the Customizer partial refresh.
|
||||
*
|
||||
* @package Gustavo_Portfolio
|
||||
*/
|
||||
|
||||
gustavoo_portfolio_the_whatsapp_float();
|
||||
Reference in New Issue
Block a user