This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
understrap/loop-templates/content-card.php

53 lines
1.3 KiB
PHP
Raw Normal View History

2016-11-17 21:18:39 +00:00
<?php
/**
* Card patrial template responsible to show individual posts in home.php page.
*
2016-11-17 21:18:39 +00:00
* @package understrap
*/
2016-11-17 21:18:39 +00:00
?>
<div class="card">
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<header class="entry-header">
<?php if ( has_post_thumbnail() ) : ?>
2016-11-17 21:18:39 +00:00
<?php
$alt = get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true );
?>
<img src="<?php echo get_the_post_thumbnail_url( $post->ID, 'large' ); ?>"
alt="<?php echo $alt; ?>"
class="card-img-top img-fluid">
<?php endif; ?>
<div class="card-block">
<?php the_title( sprintf( '<h2 class="entry-title card-title"><a href="%s" rel="bookmark">',
esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<p class="card-text"> <?php understrap_posted_on(); ?> </p>
</div><!-- .entry-meta -->
<?php endif; ?>
</div>
</header><!-- .entry-header -->
<div class="card-block">
<div class="entry-content card-text">
<?php
echo understrap_excerpt_with_length( $post->ID, 15 );
?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'understrap' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
</div>
</article><!-- #post-## -->
</div>