Created
February 7, 2024 21:06
-
-
Save dkjensen/fa919fe0dc072dea721e425f9d519271 to your computer and use it in GitHub Desktop.
Sample WP Block Template Part
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Part: Blog | |
* | |
* @package CloudCatch\Sample | |
*/ | |
use function CloudCatch\Sample\get_post_icon; | |
$sample_blog_categories = wp_get_post_terms( get_the_ID(), 'category', array( 'fields' => 'names' ) ); | |
?> | |
<article <?php post_class( 'content blog-post' ); ?>> | |
<div class="content__thumbnail"> | |
<a href="<?php echo esc_url( get_permalink() ); ?>"> | |
<?php the_post_thumbnail( 'large', array( 'class' => 'content__thumbnail-img' ) ); ?> | |
</a> | |
</div> | |
<div class="content__content"> | |
<div class="content__meta"> | |
<?php echo get_post_icon( get_the_ID(), 'news_type' ); ?> | |
<div class="content__meta-info"> | |
<?php the_date(); ?> | |
<?php if ( $sample_blog_categories && ! is_wp_error( $sample_blog_categories ) ) : ?> | |
<span class="has-yellow-light-color">•</span> <?php echo implode( ', ', $sample_blog_categories ); ?> | |
<?php endif; ?> | |
</div> | |
</div> | |
<h2 class="content__title has-heading-3-font-size"> | |
<a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a> | |
</h2> | |
<div class="content__excerpt"> | |
<?php the_excerpt(); ?> | |
</div> | |
</div> | |
</article> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment