/** * Filters the main query on homepage */ function et_home_posts_query($query = false) { /* Don't proceed if it's not homepage or the main query */ if (!is_home() || !is_a($query, 'WP_Query') || !$query->is_main_query()) { return; } if ('false' == et_get_option('feather_blog_style', 'false')) { if ('on' == et_get_option('feather_display_recentwork_section', 'on')) { $query->set('posts_per_page', (int) et_get_option('feather_posts_media', '8')); $exclude_media_categories = et_get_option('feather_exlcats_media', false); if ($exclude_media_categories) { $query->set('category__not_in', array_map('intval', et_generate_wpml_ids($exclude_media_categories, 'category'))); } } return; } /* Set the amount of posts per page on homepage */ $query->set('posts_per_page', (int) et_get_option('feather_homepage_posts', '6')); /* Exclude categories set in ePanel */ $exclude_categories = et_get_option('feather_exlcats_recent', false); if ($exclude_categories) { $query->set('category__not_in', array_map('intval', et_generate_wpml_ids($exclude_categories, 'category'))); } /* Exclude slider posts, if the slider is activated, pages are not featured and posts duplication is disabled in ePanel */ if ('on' == et_get_option('feather_featured', 'on') && 'false' == et_get_option('feather_use_pages', 'false') && 'false' == et_get_option('feather_duplicate', 'on')) { $query->set('post__not_in', et_get_featured_posts_ids()); } }
/** * Filters the main query on homepage */ function et_home_posts_query($query = false) { /* Don't proceed if it's not homepage or the main query */ if (!is_home() || !is_a($query, 'WP_Query') || !$query->is_main_query()) { return; } if (!class_exists('woocommerce') || 'on' == et_get_option('foxy_blog_style', 'false') || !is_front_page() && is_home()) { /* Exclude categories set in ePanel */ $exclude_categories = et_get_option('foxy_exlcats_recent', false, 'category'); if ($exclude_categories) { $query->set('category__not_in', array_map('intval', $exclude_categories)); } } elseif ('false' == et_get_option('foxy_blog_style', 'false')) { /* Display WooCommerce products on homepage */ $query->set('post_type', 'product'); $query->set('meta_query', array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'))); $exclude_categories = et_get_option('foxy_exlcats_recent_products', false); if ($exclude_categories) { $query->set('tax_query', array(array('taxonomy' => 'product_cat', 'field' => 'id', 'operator' => 'NOT IN', 'terms' => (array) array_map('intval', $exclude_categories)))); } } /* Exclude slider posts, if the slider is activated, pages are not featured and posts duplication is disabled in ePanel */ if ('on' == et_get_option('foxy_featured', 'on') && 'false' == et_get_option('foxy_use_pages', 'false') && 'false' == et_get_option('foxy_duplicate', 'on')) { $query->set('post__not_in', et_get_featured_posts_ids()); } }
/** * Filters the main query on homepage */ function et_home_posts_query($query = false) { /* Don't proceed if it's not homepage or the main query */ if (!is_home() || !is_a($query, 'WP_Query') || !$query->is_main_query()) { return; } /* Set the amount of posts per page on homepage */ $query->set('posts_per_page', et_get_option('nimble_homepage_posts', '6')); /* Exclude categories set in ePanel */ $exclude_categories = et_get_option('nimble_exlcats_recent', false); if ($exclude_categories) { $query->set('category__not_in', $exclude_categories); } /* Exclude slider posts, if the slider is activated, pages are not featured and posts duplication is disabled in ePanel */ if ('on' == et_get_option('nimble_featured', 'on') && 'false' == et_get_option('nimble_use_pages', 'false') && 'false' == et_get_option('nimble_duplicate', 'on')) { $query->set('post__not_in', et_get_featured_posts_ids()); } }