<div class="posts__grid"> <?php while(have_posts( )): the_post(); $postID = get_the_ID(); $cat = get_the_category($postID)[0]; $cover = get_field("cover", $postID); $introduction = get_field("introduction", $postID); $link = $cat->name === "Article" ? get_field("post_url", $postID) : get_permalink(); $target = $cat->name === "Article" ? 'target="_blank" rel="noopener noreferrer"': ''; ?> <div class="posts__cardWrapper"> <div class="posts__cardBg"> <img alt="<?php echo esc_attr($cover['alt']); ?>" class="lazy" src="<?php echo esc_attr($cover["sizes"]['thumbnail']); ?>" data-src="<?php echo esc_attr($cover["sizes"]['large']); ?>" data-srcset="<?php echo esc_attr($cover["sizes"]['medium']); ?> 300w, <?php echo esc_attr($cover["sizes"]['large']); ?> 768w, <?php echo esc_attr($cover["sizes"]['1536x1536']); ?> 1024w" data-sizes="100w" /> <div class="posts__overlay"> <div class="posts__cardCategory"> <?php echo process_post_cat(get_the_ID()); ?> </div> </div> <div class="posts__cardBgFooter"> <?php echo get_simple_likes_button( get_the_ID() ); ?> </div> </div> <div class="posts__cardBody"> <a href="<?php echo esc_attr($link)?>" <?php echo $target?>> <h2 class="heading3"><?php the_title( )?></h2> <div class="posts__descWrapper"> <p class="paragraph"><?php echo esc_html($introduction)?></p> </div> </a> </div> </div> <?php endwhile; ?> </div> <div class="posts__pagination p-t-5"> <hr> <div class="posts__paginationLinks"> <?php $pagination_args = array( 'mid_size' => 0, "next_text" => "Neste", "prev_text" => "Tidligere" ); echo paginate_links($pagination_args); ?> </div> <hr> </div>