/**
     * This function to display featured category slider
     *
     * @param $options: catchbase_theme_options from customizer
     *
     * @since Catch Base 1.0
     */
    function catchbase_category_slider($options)
    {
        $quantity = $options['featured_slide_number'];
        global $post;
        $catchbase_category_slider = '';
        $category_list = array_filter($options['featured_slider_select_category']);
        if (!empty($category_list)) {
            $get_featured_posts = new WP_Query(array('posts_per_page' => $quantity, 'category__in' => $category_list, 'ignore_sticky_posts' => 1));
            $i = 0;
            while ($get_featured_posts->have_posts()) {
                $get_featured_posts->the_post();
                $i++;
                $title_attribute = the_title_attribute(array('before' => __('', 'catch-base'), 'echo' => false));
                $excerpt = get_the_excerpt();
                if ($i == 1) {
                    $classes = 'post post-' . $post->ID . ' hentry slides displayblock';
                } else {
                    $classes = 'post post-' . $post->ID . ' hentry slides displaynone';
                }
                $catchbase_category_slider .= '
			<article class="' . $classes . '">
				<figure class="slider-image">';
                if (has_post_thumbnail()) {
                    $catchbase_category_slider .= '<a title="Permalink to ' . the_title('', '', false) . '" href="' . get_permalink() . '">
						' . get_the_post_thumbnail($post->ID, 'large', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'attached-post-image')) . '
					</a>';
                } else {
                    //Default value if there is no first image
                    $catchbase_image = '<img class="pngfix wp-post-image" src="' . get_template_directory_uri() . '/images/gallery/no-featured-image-1200x514.jpg" >';
                    //Get the first image in page, returns false if there is no image
                    $catchbase_first_image = catchbase_get_first_image($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'attached-post-image'));
                    //Set value of image as first image if there is an image present in the page
                    if ('' != $catchbase_first_image) {
                        $catchbase_image = $catchbase_first_image;
                    }
                    $catchbase_category_slider .= '<a title="Permalink to ' . the_title('', '', false) . '" href="' . get_permalink() . '">
						' . $catchbase_image . '
					</a>';
                }
                $catchbase_category_slider .= '
				</figure><!-- .slider-image -->
				<div class="entry-container">
					<header class="entry-header">
						<h1 class="entry-title">
							<a title="Permalink to ' . the_title('', '', false) . '" href="' . get_permalink() . '">' . the_title('<span>', '</span>', false) . '</a>
						</h1>
						<div class="assistive-text">' . catchbase_page_post_meta() . '</div>
					</header>';
                if ($excerpt != '') {
                    $catchbase_category_slider .= '<div class="entry-content">' . $excerpt . '</div>';
                }
                $catchbase_category_slider .= '
				</div><!-- .entry-container -->
			</article><!-- .slides -->';
            }
            wp_reset_query();
        }
        return $catchbase_category_slider;
    }
    /**
     * This function to display featured page slider
     *
     * @param $options: catchbase_theme_options from customizer
     *
     * @since Catch Base 1.0
     */
    function catchbase_page_slider($options)
    {
        $quantity = absint($options['featured_slide_number']);
        global $post;
        $output = '';
        $number_of_page = 0;
        // for number of pages
        $page_list = array();
        // list of valid page ids
        //Get number of valid pages
        for ($i = 1; $i <= $quantity; $i++) {
            if (isset($options['featured_slider_page_' . $i]) && $options['featured_slider_page_' . $i] > 0) {
                $number_of_page++;
                $page_list = array_merge($page_list, array($options['featured_slider_page_' . $i]));
            }
        }
        if (!empty($page_list) && $number_of_page > 0) {
            $get_featured_posts = new WP_Query(array('posts_per_page' => $quantity, 'post_type' => 'page', 'post__in' => $page_list, 'orderby' => 'post__in'));
            $i = 0;
            while ($get_featured_posts->have_posts()) {
                $get_featured_posts->the_post();
                $i++;
                $title_attribute = the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false));
                $excerpt = get_the_excerpt();
                if ($i == 1) {
                    $classes = 'page pageid-' . $post->ID . ' hentry slides displayblock';
                } else {
                    $classes = 'page pageid-' . $post->ID . ' hentry slides displaynone';
                }
                $output .= '
			<article class="' . $classes . '">
				<figure class="slider-image">';
                if (has_post_thumbnail()) {
                    $output .= '<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '" href="' . get_permalink() . '">
						' . get_the_post_thumbnail($post->ID, 'catchbase_slider', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'attached-page-image')) . '
					</a>';
                } else {
                    //Default value if there is no first image
                    $catchbase_image = '<img class="pngfix wp-post-image" src="' . get_template_directory_uri() . '/images/gallery/no-featured-image-1200x514.jpg" >';
                    //Get the first image in page, returns false if there is no image
                    $catchbase_first_image = catchbase_get_first_image($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'attached-page-image'));
                    //Set value of image as first image if there is an image present in the page
                    if ('' != $catchbase_first_image) {
                        $catchbase_image = $catchbase_first_image;
                    }
                    $output .= '<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '" href="' . get_permalink() . '">
						' . $catchbase_image . '
					</a>';
                }
                $output .= '
				</figure><!-- .slider-image -->
				<div class="entry-container">
					<header class="entry-header">
						<h1 class="entry-title">
							<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '" href="' . get_permalink() . '">' . the_title('<span>', '</span>', false) . '</a>
						</h1>
						<div class="assistive-text">' . catchbase_page_post_meta() . '</div>
					</header>';
                if ($excerpt != '') {
                    $output .= '<div class="entry-content">' . $excerpt . '</div>';
                }
                $output .= '
				</div><!-- .entry-container -->
			</article><!-- .slides -->';
            }
            wp_reset_query();
        }
        return $output;
    }