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

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


/****************************************
Blog Posts Lists
*****************************************/
$wrockmetro_list_block_show_on = get_theme_mod('wrockmetro_list_block_posts_location', 'index');
$wrockmetro_ticker_location = get_theme_mod('wrockmetro_ticker_location', 'all_pages');
$wrockmetro_blocktiles_location = get_theme_mod('wrockmetro_blocktiles_location', 'all_pages');

if (get_theme_mod('wrockmetro_newticker_on') !=='disable') {
	if ($wrockmetro_ticker_location === 'all_pages' || ($wrockmetro_ticker_location === 'single' && is_single()) || ($wrockmetro_ticker_location === 'page' && is_page()) || ($wrockmetro_ticker_location === 'archive' && is_archive()) || ($wrockmetro_ticker_location === 'index' && (is_home() || is_front_page()))) {
		if (get_theme_mod('wrockmetro_newsticker_style') == 'styleone'){
			wrockmetro_newticker();
		}
		else if (get_theme_mod('wrockmetro_newsticker_style') == 'styletwo'){
			wrockmetro_newtickertwo();
		}
		else if (get_theme_mod('wrockmetro_newsticker_style') == 'stylethree'){
			wrockmetro_marqueeticker();
		}
		else{
			wrockmetro_newticker();
		}
	}
}
if(get_theme_mod('wrockmetro_listblock_postson') === 'enable'){
	if ($wrockmetro_list_block_show_on === 'all_pages' || ($wrockmetro_list_block_show_on === 'single' && is_single()) || ($wrockmetro_list_block_show_on === 'page' && is_page()) || ($wrockmetro_list_block_show_on === 'archive' && is_archive()) || ($wrockmetro_list_block_show_on === 'index' && (is_home() || is_front_page()))) {
		wrockmetro_listblockposts();
	}
}

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