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

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


/****************************************
Blog Posts Lists
*****************************************/
$magazinestyle_list_block_show_on = get_theme_mod('magazinestyle_list_block_posts_location', 'index');
$magazinestyle_ticker_location = get_theme_mod('magazinestyle_ticker_location', 'all_pages');
$magazinestyle_blocktiles_location = get_theme_mod('magazinestyle_blocktiles_location', 'all_pages');

if (get_theme_mod('magazinestyle_newticker_on') !=='disable') {
	if ($magazinestyle_ticker_location === 'all_pages' || ($magazinestyle_ticker_location === 'single' && is_single()) || ($magazinestyle_ticker_location === 'page' && is_page()) || ($magazinestyle_ticker_location === 'archive' && is_archive()) || ($magazinestyle_ticker_location === 'index' && (is_home() || is_front_page()))) {
		if (get_theme_mod('magazinestyle_newsticker_style') == 'styleone'){
			magazinestyle_newticker();
		}
		else if (get_theme_mod('magazinestyle_newsticker_style') == 'styletwo'){
			magazinestyle_newtickertwo();
		}
		else if (get_theme_mod('magazinestyle_newsticker_style') == 'stylethree'){
			magazinestyle_marqueeticker();
		}
		else{
			magazinestyle_newticker();
		}
	}
}


if(get_theme_mod('magazinestyle_list_block_posts_on') =='enable'){
	if ($magazinestyle_list_block_show_on === 'all_pages' || ($magazinestyle_list_block_show_on === 'single' && is_single()) || ($magazinestyle_list_block_show_on === 'page' && is_page()) || ($magazinestyle_list_block_show_on === 'archive' && is_archive()) || ($magazinestyle_list_block_show_on === 'index' && (is_home() || is_front_page()))) {
		magazinestyle_listblockposts();
	}
}

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