/**
     * This function to display featured category content
     *
     * @param $options: catchbase_theme_options from customizer
     *
     * @since Catch Base 1.0
     */
    function catchbase_category_content($options)
    {
        global $post;
        $quantity = $options['featured_content_number'];
        $more_link_text = $options['excerpt_more_text'];
        $category_list = array_filter($options['featured_content_select_category']);
        $show_content = isset($options['featured_content_show']) ? $options['featured_content_show'] : 'excerpt';
        $catchbase_category_content = '';
        $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:', 'catch-base'), 'echo' => false));
            $excerpt = get_the_excerpt();
            $catchbase_category_content .= '
			<article id="featured-post-' . $i . '" class="post hentry featured-category-content">';
            if (has_post_thumbnail()) {
                $catchbase_category_content .= '
				<figure class="featured-homepage-image">
					<a href="' . get_permalink() . '" title="' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '">
					' . get_the_post_thumbnail($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix')) . '
					</a>
				</figure>';
            } else {
                $catchbase_first_image = catchbase_get_first_image($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix'));
                if ('' != $catchbase_first_image) {
                    $catchbase_category_content .= '
						<figure class="featured-homepage-image">
							<a href="' . get_permalink() . '" title="' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '">
								' . $catchbase_first_image . '
							</a>
						</figure>';
                }
            }
            $catchbase_category_content .= '
				<div class="entry-container">
					<header class="entry-header">
						<h1 class="entry-title">
							<a href="' . get_permalink() . '" rel="bookmark">' . the_title('', '', false) . '</a>
						</h1>
					</header>';
            if ('excerpt' == $show_content) {
                $catchbase_category_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);
                $catchbase_category_content .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
            }
            $catchbase_category_content .= '
				</div><!-- .entry-container -->
			</article><!-- .featured-post-' . $i . ' -->';
        }
        wp_reset_query();
        return $catchbase_category_content;
    }
    /**
     * This function to display featured page content
     *
     * @param $options: catchbase_theme_options from customizer
     *
     * @since Catch Base 1.0
     */
    function catchbase_page_content($options)
    {
        global $post;
        $quantity = $options['featured_content_number'];
        $more_link_text = $options['excerpt_more_text'];
        $show_content = isset($options['featured_content_show']) ? $options['featured_content_show'] : 'excerpt';
        $catchbase_page_content = '';
        $number_of_page = 0;
        // for number of pages
        $page_list = array();
        // list of valid pages ids
        //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;
            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();
                $catchbase_page_content .= '
				<article id="featured-post-' . $i . '" class="post hentry featured-page-content">';
                if (has_post_thumbnail()) {
                    $catchbase_page_content .= '
					<figure class="featured-homepage-image">
						<a href="' . get_permalink() . '" "' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '">
						' . get_the_post_thumbnail($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix')) . '
						</a>
					</figure>';
                } else {
                    $catchbase_first_image = catchbase_get_first_image($post->ID, 'medium', array('title' => esc_attr($title_attribute), 'alt' => esc_attr($title_attribute), 'class' => 'pngfix'));
                    if ('' != $catchbase_first_image) {
                        $catchbase_page_content .= '
						<figure class="featured-homepage-image">
							<a href="' . get_permalink() . '" title=""' . the_title_attribute(array('before' => __('Permalink to:', 'catch-base'), 'echo' => false)) . '">
								' . $catchbase_first_image . '
							</a>
						</figure>';
                    }
                }
                $catchbase_page_content .= '
					<div class="entry-container">
						<header class="entry-header">
							<h1 class="entry-title">
								<a href="' . get_permalink() . '" rel="bookmark">' . the_title('', '', false) . '</a>
							</h1>
						</header>';
                if ('excerpt' == $show_content) {
                    $catchbase_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);
                    $catchbase_page_content .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
                }
                $catchbase_page_content .= '
					</div><!-- .entry-container -->
				</article><!-- .featured-post-' . $i . ' -->';
            }
            wp_reset_query();
        }
        return $catchbase_page_content;
    }
    /**
     * 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;
    }