diff --git a/category-en.php b/category-en.php index b91d623..b85c2c1 100644 --- a/category-en.php +++ b/category-en.php @@ -1,7 +1,7 @@
- +
'date', // сортировка по дате 'order' => 'DESC', // по убыванию (сначала новые) 'ignore_sticky_posts' => 1, - 'cat' => get_expression_en() + 'cat' => EN_PARTS ); $query = new WP_Query($args); ?> - false, 'query' => $query]); ?> + false, 'query' => $query]); ?>
diff --git a/en/category-en-sub.php b/en/category-en-sub.php new file mode 100644 index 0000000..cd23b07 --- /dev/null +++ b/en/category-en-sub.php @@ -0,0 +1,24 @@ + +
+ +
+ +

name ?>

+ +
+
+ 'post', + 'posts_per_page' => 5, + 'paged' => $paged, + 'category__in' => get_queried_object_id() + ); + $query = new WP_Query($args); + ?> + $query]); ?> +
+ +
+ \ No newline at end of file diff --git a/en/category-menu-en.php b/en/category-menu-en.php new file mode 100644 index 0000000..1745957 --- /dev/null +++ b/en/category-menu-en.php @@ -0,0 +1,35 @@ + EN_PARTS, + 'orderby' => 'name', + 'order' => 'ASC', + 'hide_empty' => false +)); + + +$firstElement = array_shift($categories); +array_push($categories, $firstElement); + +foreach ($categories as $category) { + if ($category->slug === 'uncategorized') continue; + + $icon = get_field('icon', 'category_' . $category->term_id); + $bg_image = get_field('bg_image', 'category_' . $category->term_id); + $category_link = get_category_link($category->term_id); +?> + + + + name); ?> + + \ No newline at end of file diff --git a/en/category-menu-for-category-en.php b/en/category-menu-for-category-en.php new file mode 100644 index 0000000..3a1b2fb --- /dev/null +++ b/en/category-menu-for-category-en.php @@ -0,0 +1,36 @@ + EN_PARTS, + 'taxonomy' => 'category', + 'orderby' => 'ID', + 'order' => 'ASC', + 'hide_empty' => false +); +$categories = get_categories($arg_cat); +$current_term = get_queried_object(); + +// Получаем ID текущей категории или категорий поста +$current_term_ids = []; +if (is_single()) { + $current_term_ids = wp_get_post_categories($current_term->ID); +} elseif (is_category()) { + $current_term_ids[] = $current_term->term_id; +} + +$firstElement = array_shift($categories); +array_push($categories, $firstElement); + + foreach ($categories ?? [] as $cat) { + if ($cat->slug === 'uncategorized') continue; + $icon = get_field('icon', 'category_' . $cat->term_id); + $bg_image = get_field('bg_image', 'category_' . $cat->term_id); + + $class = in_array($cat->term_id, $current_term_ids) ? 'is-active' : ''; + + echo " + + $cat->name + + "; + } diff --git a/en/content-post-en.php b/en/content-post-en.php new file mode 100644 index 0000000..ed2dd1d --- /dev/null +++ b/en/content-post-en.php @@ -0,0 +1,20 @@ + +
+ + +
+
+
+
+ +
+ + +

+ +
+
\ No newline at end of file diff --git a/en/latest-legislation-posts-en.php b/en/latest-legislation-posts-en.php new file mode 100644 index 0000000..d1a5fd8 --- /dev/null +++ b/en/latest-legislation-posts-en.php @@ -0,0 +1,28 @@ +
+

Regulation

+ +
\ No newline at end of file diff --git a/partials/mainmenu-en.php b/en/mainmenu-en.php similarity index 100% rename from partials/mainmenu-en.php rename to en/mainmenu-en.php diff --git a/en/most-read-posts-en.php b/en/most-read-posts-en.php new file mode 100644 index 0000000..4d5d440 --- /dev/null +++ b/en/most-read-posts-en.php @@ -0,0 +1,46 @@ +prepare(" + SELECT DISTINCT p.ID, p.post_title, p.post_content, m.meta_value AS top_participation_position + FROM $wpdb->posts p + INNER JOIN $wpdb->postmeta m ON p.ID = m.post_id + LEFT JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id + LEFT JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id + WHERE p.post_type = 'post' + AND m.meta_key = 'top_participation_position' + AND m.meta_value != '' + AND tt.term_id IN ($included_category_ids_in) + ORDER BY CAST(m.meta_value AS UNSIGNED) ASC +"); + + +$top_posts = $wpdb->get_results($query); + +// Вывод результатов +if (!empty($top_posts)) { + foreach ($top_posts as $post) { + $permalink = get_permalink($post->ID); + $title = get_the_title($post->ID); +?> + +Нет просмотренных постов.

'; +} +?> \ No newline at end of file diff --git a/en/pinned-post-en.php b/en/pinned-post-en.php new file mode 100644 index 0000000..de8a9d9 --- /dev/null +++ b/en/pinned-post-en.php @@ -0,0 +1,25 @@ + + + +
+ ID); ?> +
+ +
+

+ ID); ?> +

+

+ ID); ?> +

+
+
+
+ + \ No newline at end of file diff --git a/en/pinned-post-mob-en.php b/en/pinned-post-mob-en.php new file mode 100644 index 0000000..86db508 --- /dev/null +++ b/en/pinned-post-mob-en.php @@ -0,0 +1,25 @@ +ID; +?> + +
Top
+ +
+ + + + ID ); ?> +
ID) );?>
+
+
+ ID); ?> +

ID); ?>

+
+ +
+ + \ No newline at end of file diff --git a/en/post-list-en.php b/en/post-list-en.php new file mode 100644 index 0000000..1b8dc30 --- /dev/null +++ b/en/post-list-en.php @@ -0,0 +1,23 @@ +have_posts()) { + while ($query->have_posts()) { + $post_count++; + $query->the_post(); + get_template_part('en/content', 'post-en', ['full_width' => $post_count === 1 && $large_first_image]); + if ($post_count === ($large_first_image ? 5 : 4)) : ?> + + + + \ No newline at end of file diff --git a/en/related-posts-en.php b/en/related-posts-en.php new file mode 100644 index 0000000..acf95e6 --- /dev/null +++ b/en/related-posts-en.php @@ -0,0 +1,33 @@ +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 '
Read also:
'; + echo '
'; + + while ($related_posts_query->have_posts()) { + $related_posts_query->the_post(); + get_template_part('en/content', 'post-en'); + } + + echo '
'; + wp_reset_postdata(); + } +} +?> \ No newline at end of file diff --git a/footer-en.php b/footer-en.php index f6e2090..0cc51c1 100644 --- a/footer-en.php +++ b/footer-en.php @@ -1,7 +1,7 @@
- +
@@ -17,11 +17,11 @@ agroexpert.press