Initial commit: peptide-starter theme v1.3.1
This commit is contained in:
48
template-parts/content-peptide.php
Normal file
48
template-parts/content-peptide.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying peptide cards in archive views
|
||||
*
|
||||
* @package peptide-starter
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'peptide-card' ); ?>>
|
||||
<header class="peptide-card__header">
|
||||
<h2 class="peptide-card__title">
|
||||
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
||||
</h2>
|
||||
<?php
|
||||
$categories = get_the_terms( get_the_ID(), 'peptide-category' );
|
||||
if ( $categories && ! is_wp_error( $categories ) ) {
|
||||
echo '<div class="peptide-card__meta">';
|
||||
foreach ( array_slice( $categories, 0, 2 ) as $cat ) {
|
||||
echo '<span class="peptide-card__badge">' . esc_html( $cat->name ) . '</span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</header>
|
||||
|
||||
<div class="peptide-card__excerpt">
|
||||
<?php
|
||||
if ( has_excerpt() ) {
|
||||
echo wp_kses_post( wp_trim_words( get_the_excerpt(), 25, '…' ) );
|
||||
} else {
|
||||
echo wp_kses_post( wp_trim_words( get_the_content(), 25, '…' ) );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<footer class="peptide-card__footer">
|
||||
<a href="<?php the_permalink(); ?>" class="peptide-card__link">
|
||||
<?php esc_html_e( 'Learn More', 'peptide-starter' ); ?>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path d="M3 8H13M13 8L9 4M13 8L9 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</a>
|
||||
</footer>
|
||||
</article>
|
||||
Reference in New Issue
Block a user