File: /home/nyiet8349bzl/public_html/ducoa.org/wp-content/themes/dustrial/template-parts/content.php
<?php
/**
* Template part for displaying posts.
*
* @package dustrial
*/
if( function_exists( 'dustrial_framework_init' ) ) {
$content_excerpt = dustrial_get_option('blog_post_excerpt_length');
$blog_page_readmore_switch = dustrial_get_option('blog_page_readmore_switch');
$blog_page_readmore_title = dustrial_get_option('blog_page_readmore_title');
$blog_post_col_layout = dustrial_get_option('blog_post_col_layout');
$blog_post_comments = dustrial_get_option('blog_post_comments');
if ( $blog_post_col_layout == 'col_2' ) {
$col_layout = '6';
} elseif ( $blog_post_col_layout == 'col_3' ) {
$col_layout = '4';
} elseif ( $blog_post_col_layout == 'col_4' ) {
$col_layout = '3';
} else {
$col_layout = '12';
}
} else {
$col_layout = '12';
$content_excerpt = '20';
$blog_post_comments = 'true';
}
if ($col_layout == '6') {
$crop_img = 'dustrial-570';
} elseif ($col_layout == '4') {
$crop_img = 'dustrial-362';
} elseif ($col_layout == '3') {
$crop_img = 'dustrial-362';
} else {
$crop_img = 'full';
}
?>
<div class="col-12 col-lg-<?php echo esc_attr( $col_layout ); ?>">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="single-blog">
<?php if(has_post_thumbnail()) { ?>
<div class="single-blog-thumb">
<a href="<?php the_permalink(); ?>" aria-label="<?php the_title_attribute(); ?>">
<?php
$alt_text = get_the_title(); // or use get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true )
the_post_thumbnail( $crop_img, array(
'class' => 'img-fluid',
'alt' => esc_attr( $alt_text ),
'loading' => 'lazy', // Lazy load added here too
));
?>
<span class="icon"><i class="fa fa-link"></i></span>
</a>
</div>
<?php } ?>
<div class="content">
<div class="entry-meta">
<div class="author">
<?php esc_html_e('By ', 'dustrial'); ?><?php the_author_posts_link(); ?>
</div>
<div class="month">
<a href="<?php echo get_month_link( get_the_time('Y'), get_the_time('m') ); ?>">
<?php echo get_the_date(); ?>
</a>
</div>
</div>
<h3><a href="<?php the_permalink(); ?>" class="entry-title"><?php the_title(); ?></a></h3>
<div class="entry-content"><?php echo dustrial_excerpt( $content_excerpt );?></div>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'dustrial' ),
'after' => '</div>',
) );
?>
</div>
<div class="entry-meta-footer">
<ul>
<?php if ( !empty( $blog_page_readmore_switch ) ) : ?>
<?php if ( !empty( $blog_page_readmore_title ) ) : ?>
<li class="read-more-btn">
<a href="<?php the_permalink(); ?>" aria-label="Read more about <?php the_title_attribute(); ?>">
<?php echo esc_html( $blog_page_readmore_title ); ?>
<i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</li>
<?php endif; ?>
<?php endif; ?>
<li class="comments-area">
<?php if (!empty($blog_post_comments)) { ?>
<a href="<?php comments_link(); ?>"> <i class="fa fa-comments-o" aria-hidden="true"></i> <?php comments_number(esc_html__( 'Comments: 0', "dustrial" ), esc_html__( 'Comments: 1', "dustrial" ),esc_html__( '% Comments', "dustrial" )); ?></a>
<?php } ?>
</li>
</ul>
</div>
</div>
</article>
</div>