Amy-Mir / loop-templates / cards-hblog.php
cards-hblog.php
Raw
<?php
/**
 * The template part for displaying home page blog posts
 * 
 * @uses Parent div tag class attribute "blogCards__container" to init stylings
 *  
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;


if($args["isArticle"] !== false):
    $anchor = 'href="' . $args["isArticle"] .'" target="_blank" rel="noopener noreferrer"';
else:
    $anchor = 'href="' . $args["permalink"] . '"';  
endif;
?>

<a <?php echo $anchor?> class="blogCard__wrapper">
    <div class="blogCard__background">
        
    <img alt="<?php echo esc_attr($args['image']['alt']); ?>" class="lazy"
            src="<?php echo esc_attr($args['image']["sizes"]['thumbnail']); ?>"
            data-src="<?php echo esc_attr($args['image']["sizes"]['large']); ?>" 
            data-srcset="<?php echo esc_attr($args['image']["sizes"]['medium']); ?> 300w,
            <?php echo esc_attr($args['image']["sizes"]['large']); ?> 768w,
            <?php echo esc_attr($args['image']["sizes"]['1536x1536']); ?> 1024w" 
            data-sizes="100w" />

    </div>
    <div class="blogCard__contentWrapper">
        <div class="blogCard__content">
            <h1 class="heading2"><?php echo esc_html($args["title"]) ?></h1>
            <p class="paragraph"><?php echo esc_html($args["intro"]) ?></p>
        </div>
        <?php echo process_post_cat($args["postID"], false); ?>
    </div>
</a>