<?php
/**
 * Custom functions that act independently of the theme templates
 *
 * Eventually, some of the functionality here could be replaced by core features.
 *
 * @package Digital
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;


/****************************************
Blog Posts Lists
*****************************************/
$digital_list_block_show_on = get_theme_mod('digital_list_block_posts_location', 'index');
$digital_ticker_location = get_theme_mod('digital_ticker_location', 'all_pages');
$digital_blocktiles_location = get_theme_mod('digital_blocktiles_location', 'all_pages');

if (get_theme_mod('digital_newticker_on') !=='disable') {
	if ($digital_ticker_location === 'all_pages' || ($digital_ticker_location === 'single' && is_single()) || ($digital_ticker_location === 'page' && is_page()) || ($digital_ticker_location === 'archive' && is_archive()) || ($digital_ticker_location === 'index' && (is_home() || is_front_page()))) {
		if (get_theme_mod('digital_newsticker_style') == 'styleone'){
			digital_newticker();
		}
		else if (get_theme_mod('digital_newsticker_style') == 'styletwo'){
			digital_newtickertwo();
		}
		else if (get_theme_mod('digital_newsticker_style') == 'stylethree'){
			digital_marqueeticker();
		}
		else{
			digital_newticker();
		}
	}
}


if(get_theme_mod('digital_list_block_posts_on') =='enable'){
	if ($digital_list_block_show_on === 'all_pages' || ($digital_list_block_show_on === 'single' && is_single()) || ($digital_list_block_show_on === 'page' && is_page()) || ($digital_list_block_show_on === 'archive' && is_archive()) || ($digital_list_block_show_on === 'index' && (is_home() || is_front_page()))) {
		digital_listblockposts();
	}
}

if(get_theme_mod('digital_blocktiles_on') !=='disable'){
	if ($digital_blocktiles_location === 'all_pages' || ($digital_blocktiles_location === 'single' && is_single()) || ($digital_blocktiles_location === 'page' && is_page()) || ($digital_blocktiles_location === 'archive' && is_archive()) || ($digital_blocktiles_location === 'index' && (is_home() || is_front_page()))) {
		digital_blocktilesposts();
	}
}