$recent_content_type, 'posts_per_page' => absint( 5 ), 'ignore_sticky_posts' => true, ); if ( ! empty( array_filter( $recent_content_ids ) ) ) { $recent_args['post__in'] = array_filter( $recent_content_ids ); $recent_args['orderby'] = 'post__in'; } else { $recent_args['orderby'] = 'date'; } } elseif ( $recent_content_type === 'category' ) { $cat_content_id = get_theme_mod( 'ace_news_recent_news_content_category' ); $recent_args = array( 'cat' => $cat_content_id, 'posts_per_page' => absint( 5 ), ); } $recent_args = apply_filters( 'ace_news_banner_section_args', $recent_args ); if ( $slider_content_type === 'post' ) { for ( $i = 1; $i <= 3; $i++ ) { $slider_content_ids[] = get_theme_mod( 'ace_news_banner_slider_content_post_' . $i ); } $banner_slider_args = array( 'post_type' => 'post', 'post__in' => array_filter( $slider_content_ids ), 'orderby' => 'post__in', 'posts_per_page' => absint( 3 ), 'ignore_sticky_posts' => true, ); if ( ! empty( array_filter( $slider_content_ids ) ) ) { $banner_slider_args['post__in'] = array_filter( $slider_content_ids ); $banner_slider_args['orderby'] = 'post__in'; } else { $banner_slider_args['orderby'] = 'date'; } } elseif ( $slider_content_type === 'category' ) { $cat_content_id = get_theme_mod( 'ace_news_banner_slider_content_category' ); $banner_slider_args = array( 'cat' => $cat_content_id, 'posts_per_page' => absint( 3 ), ); } $banner_slider_args = apply_filters( 'ace_news_banner_section_args', $banner_slider_args ); if ( $editor_content_type === 'post' ) { for ( $i = 1; $i <= 2; $i++ ) { $editor_content_ids[] = get_theme_mod( 'ace_news_editor_choice_content_post_' . $i ); } $editor_args = array( 'post_type' => $editor_content_type, 'post__in' => array_filter( $editor_content_ids ), 'orderby' => 'post__in', 'posts_per_page' => absint( 2 ), 'ignore_sticky_posts' => true, ); if ( ! empty( array_filter( $editor_content_ids ) ) ) { $editor_args['post__in'] = array_filter( $editor_content_ids ); $editor_args['orderby'] = 'post__in'; } else { $editor_args['orderby'] = 'date'; } } elseif ( $editor_content_type === 'category' ) { $cat_content_id = get_theme_mod( 'ace_news_editor_choice_content_category' ); $editor_args = array( 'cat' => $cat_content_id, 'posts_per_page' => absint( 2 ), ); } $editor_args = apply_filters( 'ace_news_banner_section_args', $editor_args ); ace_news_render_banner_section( $recent_args, $banner_slider_args, $editor_args ); /** * Render Banner Section. */ function ace_news_render_banner_section( $recent_args, $banner_slider_args, $editor_args ) { $slider_title = get_theme_mod( 'ace_news_banner_slider_title', __( 'Banner Slider', 'ace-news' ) ); $editor_title = get_theme_mod( 'ace_news_editor_choice_title', __( 'Editor Choice', 'ace-news' ) ); $viewall_button = get_theme_mod( 'ace_news_editor_choice_button_label', __( 'View All', 'ace-news' ) ); $button_url = get_theme_mod( 'ace_news_editor_choice_button_link' ); $content_type = get_theme_mod( 'ace_news_editor_choice_content_type', 'post' ); if ( 'category' === $content_type ) { $editor_category = get_theme_mod( 'ace_news_editor_choice_content_category' ); $button_url = ! empty( $button_url ) ? $button_url : get_category_link( $editor_category ); } else { $button_url = ! empty( $button_url ) ? $button_url : '#'; } $recent_title = get_theme_mod( 'ace_news_recent_news_title', __( 'Recent News', 'ace-news' ) ); $viewall_button = get_theme_mod( 'ace_news_recent_news_button_label', __( 'View All', 'ace-news' ) ); $button_url = get_theme_mod( 'ace_news_recent_news_button_link' ); $content_type = get_theme_mod( 'ace_news_recent_news_content_type', 'post' ); if ( 'category' === $content_type ) { $recent_category = get_theme_mod( 'ace_news_recent_news_content_category' ); $button_url = ! empty( $button_url ) ? $button_url : get_category_link( $recent_category ); } else { $button_url = ! empty( $button_url ) ? $button_url : '#'; } ?>