filtered frontpage EN posts
This commit is contained in:
@@ -247,10 +247,25 @@ function custom_pagination($query = null)
|
||||
function my_theme_scripts() {
|
||||
|
||||
if (is_front_page() || (is_category() && !is_paged())) {
|
||||
wp_enqueue_script('my-load-more', get_template_directory_uri() . '/js/load-main-scroll.js', array('jquery'), null, true);
|
||||
wp_enqueue_script('my-load-more', get_template_directory_uri() . '/js/load-main-scroll.js', array('jquery'), '1.0.1', true);
|
||||
|
||||
$query_vars = array('post_type' => 'post', 'posts_per_page' => 10);
|
||||
if (is_category()) {
|
||||
|
||||
if (is_front_page()) {
|
||||
|
||||
// Получаем ID категории, которую мы хотим исключить (например, категория с ID 740)
|
||||
$excluded_category_id = 740;
|
||||
|
||||
// Получаем все подкатегории категории с ID 740
|
||||
$excluded_categories = get_categories(array(
|
||||
'child_of' => $excluded_category_id,
|
||||
'fields' => 'ids' // Получаем только ID подкатегорий
|
||||
));
|
||||
|
||||
// Включаем в запрос параметр, чтобы исключить категорию и её подкатегории
|
||||
$query_vars['category__not_in'] = array_merge(array($excluded_category_id), $excluded_categories);
|
||||
|
||||
} elseif (is_category()) {
|
||||
$category = get_queried_object();
|
||||
$query_vars['cat'] = $category->term_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user