fix theme option include/exlude featured posts from content

This commit is contained in:
Alexander Agnarson 2021-01-27 13:27:28 +01:00
parent 8164b15461
commit b4a7efb2f6
3 changed files with 8 additions and 8 deletions

View file

@ -511,7 +511,7 @@ if ( ! function_exists( 'airl_get_featured_post_ids' ) ) {
function airl_get_featured_post_ids() {
$args = array(
'category' => absint( get_theme_mod('featured-category','') ),
'numberposts' => absint( get_theme_mod('featured-posts-count','0')),
'numberposts' => absint( get_theme_mod('featured-posts-count','7')),
);
$posts = get_posts($args);
if ( !$posts ) return false;
@ -629,11 +629,11 @@ if ( ! function_exists( 'airl_pre_get_posts' ) ) {
if ( $query->is_home() ) {
// Featured posts enabled
if ( get_theme_mod('featured-posts-count','0') != '0' ) {
if ( get_theme_mod('featured-posts-count','7') != '0' ) {
// Get featured post ids
$featured_post_ids = airl_get_featured_post_ids();
// Exclude posts
if ( $featured_post_ids && !get_theme_mod('featured-posts-include') )
if ( $featured_post_ids && get_theme_mod('featured-posts-include','off') =='on' )
$query->set('post__not_in', $featured_post_ids);
}
}