add folder EN

This commit is contained in:
argoexpert press
2024-05-24 21:37:57 +03:00
parent 4fa7a19433
commit 009f8e40c2
22 changed files with 732 additions and 80 deletions

33
en/related-posts-en.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
$current_post_id = get_the_ID();
// Получаем категории текущего поста
$categories = get_the_category($current_post_id);
if ($categories) {
$category_ids = array_map(function ($category) {
return $category->term_id;
}, $categories);
$args = array(
'category__in' => $category_ids,
'post__not_in' => array($current_post_id),
'posts_per_page' => 4,
);
$related_posts_query = new WP_Query($args);
if ($related_posts_query->have_posts()) {
echo '<div class="article-section__title">Read also:</div>';
echo '<div class="articles-preview">';
while ($related_posts_query->have_posts()) {
$related_posts_query->the_post();
get_template_part('en/content', 'post-en');
}
echo '</div>';
wp_reset_postdata();
}
}
?>