banner slider section. * * @package business-class */ /** * Exit if accessed directly. */ if ( ! defined( 'ABSPATH' ) ) { exit; } $panel_name = 'Front Page'; $section_name = 'Why Choose Us'; $enable_section = business_class_get_theme_mod( $panel_name, $section_name, 'Enable Section' ); if ( ! $enable_section ) { return; } $content_box = array(); $heading = business_class_get_theme_mod( $panel_name, $section_name, 'heading' ); $sub_heading = business_class_get_theme_mod( $panel_name, $section_name, 'sub_heading' ); $content_type = business_class_get_theme_mod( $panel_name, $section_name, 'Content Type' ); $number_of_items = business_class_get_theme_mod( $panel_name, $section_name, 'number_of_items' ); if ( 'by_category' === $content_type ) { $category = business_class_get_theme_mod( $panel_name, $section_name, 'Select Category' ); $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $number_of_items, ); if ( ! empty( $category ) ) { $args['tax_query'] = array( // phpcs:ignore array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $category ), ), ); } $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { $index = 0; while ( $the_query->have_posts() ) { $the_query->the_post(); $content_box[ $index ] = array( 'title' => get_the_title(), 'content' => get_the_excerpt(), 'link' => get_the_permalink(), 'icon' => business_class_get_post_meta( get_the_ID(), 'fa_icon' ), ); $index++; } } wp_reset_postdata(); } elseif ( 'manual_entry' === $content_type ) { $content_box = business_class_get_theme_mod( $panel_name, $section_name, 'Contents Box' ); } ?>