WP_Query is a PHP class that allows you to retrieve posts from a database based on a variety of criteria. For example, we can get posts: For work, we need to consider the main parameters of the labels. Using which we get posts related to certain tags. Also, to form a request to receive records, we need such parameters: <?php
function show_posts_by_tags($tag_id, $post_id, $post_per_page, $orderby, $order){
$params = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => $orderby,
'order' => $order,
'posts_per_page' => $post_per_page,
'tag_id' => $tag_id,
'post__not_in' => array($post_id),
);
$query = new WP_Query($params);
if($query->have_posts()): ?>
<div class="container">
<ul class="article-section__list">
<?php
while ($query->have_posts()):
$query->the_post();
get_template_part('templa