
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php

if ( ! function_exists( 'presso_get_breaking_news_posts' ) ) {
	function presso_get_breaking_news_posts() {
		// Prepare query args
		$args = array(
			'posts_per_page'=> presso_get_theme_option( 'breaking_news_count' ),
			'post_order'=> presso_get_theme_option( 'breaking_news_source' ),
		);

		if ( is_single() ) {
			$args[ 'post__not_in' ] = array( get_the_id() );
		}

		return new WP_Query( apply_filters( 'presso_filter_breaking_news_query_args', presso_build_query( $args ) ) );
	}
}

if ( ! function_exists( 'presso_can_display_breaking_news' ) ) {
	function presso_can_display_breaking_news() {
		$location = presso_get_theme_option( 'breaking_news_display' );
		$layout = presso_get_theme_option( 'breaking_news_loop_layout' );
		$can_display = false;

		if ( is_front_page() ) {
			if ( $location[ 'home' ] == '1' ) $can_display = true;
			
		} elseif ( presso_is_woocommerce() ) {
			if ( $location[ 'shop' ] == '1' ) $can_display = true;

		} elseif ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
			if ( $location[ 'bbpress' ] == '1' ) $can_display = true;

		} elseif ( is_home() ) {
			if ( $location[ 'blog' ] == '1' ) $can_display = true;

		} elseif ( is_archive() ) {
			if ( $location[ 'archive' ] == '1' ) $can_display = true;

		} elseif ( is_single() ) {
			if ( $location[ 'post' ] == '1' ) $can_display = true;

		} elseif ( is_page() ) {
			if ( $location[ 'page' ] == '1' ) $can_display = true;

		} elseif ( $location[ 'any' ] == '1' ) {
			$can_display = true;

		}

		if ( 'none' == $layout ) {
			$can_display = false;
		}

		return apply_filters( 'presso_filter_can_display_breaking_news', $can_display );
	}
}