/**
     * This function to display featured page content
     *
     * @param $options: catchadaptive_theme_options from customizer
     *
     * @since Catch Adaptive 0.1
     */
    function catchadaptive_page_content($options)
    {
        global $post;
        $quantity = $options['featured_content_number'];
        $show_content = $options['featured_content_show'];
        $catchadaptive_page_content = '';
        $number_of_page = 0;
        // for number of pages
        $page_list = array();
        // list of valid pages ids
        if ('layout-four' == $options['featured_content_layout']) {
            $layouts = 4;
        } else {
            $layouts = 3;
        }
        //Get valid pages
        for ($i = 1; $i <= $quantity; $i++) {
            if (isset($options['featured_content_page_' . $i]) && $options['featured_content_page_' . $i] > 0) {
                $number_of_page++;
                $page_list = array_merge($page_list, array($options['featured_content_page_' . $i]));
            }
        }
        if (!empty($page_list) && $number_of_page > 0) {
            $get_featured_posts = new WP_Query(array('posts_per_page' => $number_of_page, 'post__in' => $page_list, 'orderby' => 'post__in', 'post_type' => 'page'));
            $i = 0;
            $catchadaptive_page_content = '
		<div class="featured_content_slider_wrap">';
            while ($get_featured_posts->have_posts()) {
                $get_featured_posts->the_post();
                $i++;
                $title_attribute = the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false));
                $excerpt = get_the_excerpt();
                $catchadaptive_page_content .= '
				<article id="featured-post-' . $i . '" class="post hentry featured-page-content">';
                if (has_post_thumbnail()) {
                    $catchadaptive_page_content .= '
					<figure class="featured-homepage-image">
						<a href="' . get_permalink() . '" title="' . the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false)) . '">
						' . get_the_post_thumbnail($post->ID, 'catchadaptive-featured-content', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix')) . '
						</a>
					</figure>';
                } else {
                    //Default value if there is no first image
                    $catchadaptive_image = '<img class="pngfix wp-post-image" src="' . get_template_directory_uri() . '/images/gallery/no-featured-image-1680x720.jpg" >';
                    //Get the first image in page, returns false if there is no image
                    $catchadaptive_first_image = catchadaptive_get_first_image($post->ID, 'catchadaptive-featured-content', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix'));
                    //Set value of image as first image if there is an image present in the page
                    if ('' != $catchadaptive_first_image) {
                        $catchadaptive_image = $catchadaptive_first_image;
                    }
                    $catchadaptive_page_content .= '<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false)) . '" href="' . get_permalink() . '">
						' . $catchadaptive_image . '
					</a>';
                }
                if ('1' == $options['featured_content_enable_title'] || 'hide-content' != $show_content) {
                    $catchadaptive_page_content .= '
					<div class="entry-container">';
                    if ('1' == $options['featured_content_enable_title']) {
                        $catchadaptive_page_content .= the_title('<header class="entry-header"><h1 class="entry-title">', '</h1></header>', false);
                    }
                    if ('excerpt' == $show_content) {
                        $catchadaptive_page_content .= '<div class="entry-excerpt"><p>' . $excerpt . '</p></div><!-- .entry-excerpt -->';
                    } elseif ('full-content' == $show_content) {
                        $content = apply_filters('the_content', get_the_content());
                        $content = str_replace(']]>', ']]&gt;', $content);
                        $catchadaptive_page_content .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
                    }
                    $catchadaptive_page_content .= '
					</div><!-- .entry-container -->';
                }
                $catchadaptive_page_content .= '
				</article><!-- .featured-page-' . $i . ' -->';
                if (0 == $i % $layouts && $i < $number_of_page) {
                    //end and start featured_content_slider_wrap div based on logic
                    $catchadaptive_page_content .= '
				</div><!-- .featured_content_slider_wrap -->
				
				<div class="featured_content_slider_wrap">';
                }
            }
            wp_reset_query();
            $catchadaptive_page_content .= '</div><!-- .featured_content_slider_wrap -->';
        }
        return $catchadaptive_page_content;
    }
    /**
     * This function to display featured category slider
     *
     * @param $options: catchadaptive_theme_options from customizer
     *
     * @since Catch Adaptive 0.1
     */
    function catchadaptive_category_slider($options)
    {
        $quantity = $options['featured_slide_number'];
        global $post;
        $catchadaptive_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' => __('Permalink to:', 'catchadaptive'), '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';
                }
                $catchadaptive_category_slider .= '
			<article class="' . $classes . '">
				<figure class="slider-image">';
                if (has_post_thumbnail()) {
                    $catchadaptive_category_slider .= '<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false)) . '" href="' . get_permalink() . '">
						' . get_the_post_thumbnail($post->ID, 'catchadaptive_slider', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix')) . '
					</a>';
                } else {
                    //Default value if there is no first image
                    $catchadaptive_image = '<img class="pngfix wp-post-image" src="' . get_template_directory_uri() . '/images/gallery/no-featured-image-1680x720.jpg" >';
                    //Get the first image in page, returns false if there is no image
                    $catchadaptive_first_image = catchadaptive_get_first_image($post->ID, 'catchadaptive-slider', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix'));
                    //Set value of image as first image if there is an image present in the page
                    if ('' != $catchadaptive_first_image) {
                        $catchadaptive_image = $catchadaptive_first_image;
                    }
                    $catchadaptive_category_slider .= '<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false)) . '" href="' . get_permalink() . '">
						' . $catchadaptive_image . '
					</a>';
                }
                $catchadaptive_category_slider .= '
				</figure><!-- .slider-image -->
				<div class="entry-container">
					<header class="entry-header">
						<h1 class="entry-title">
							<a title="' . the_title_attribute(array('before' => __('Permalink to:', 'catchadaptive'), 'echo' => false)) . '" href="' . get_permalink() . '">' . the_title('<span>', '</span>', false) . '</a>
						</h1>
						<div class="assistive-text">' . catchadaptive_page_post_meta() . '</div>
					</header>';
                if ($excerpt != '') {
                    $catchadaptive_category_slider .= '<div class="entry-content">' . $excerpt . '</div>';
                }
                $catchadaptive_category_slider .= '
				</div><!-- .entry-container -->
			</article><!-- .slides -->';
            }
            wp_reset_query();
        }
        return $catchadaptive_category_slider;
    }