<?php

/**
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */

if (!function_exists('citymag_post_blocks_function')) {

	function citymag_post_blocks_function() {

		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

		if(1 == $paged) {
			
			if ( 
				(citymag_setting('citymag_postblock_1_layout', 'module-1') <> 'disable') &&
				(citymag_setting('citymag_postblock_1_category','none') <> 'none' ) 
			) {
	
				echo call_user_func(
					'citymag_get_' . str_replace('-', '_', citymag_setting('citymag_postblock_1_layout', 'module-1')),
					citymag_setting('citymag_postblock_1_show_label', true),
					citymag_setting('citymag_postblock_1_label'),
					citymag_setting('citymag_postblock_1_truncate_post_titles', false),
					citymag_setting('citymag_postblock_1_category')
				);
	
			}
					
			if ( 
				(citymag_setting('citymag_postblock_2_layout', 'disable') <> 'disable') &&
				(citymag_setting('citymag_postblock_2_category','none') <> 'none' )
			) {
	
				echo call_user_func(
					'citymag_get_' . str_replace('-', '_', citymag_setting('citymag_postblock_2_layout')),
					citymag_setting('citymag_postblock_2_show_label', true),
					citymag_setting('citymag_postblock_2_label'),
					citymag_setting('citymag_postblock_2_truncate_post_titles', false),
					citymag_setting('citymag_postblock_2_category')
				);
	
			}
				
		}
		
	}

	add_action( 'citymag_post_blocks', 'citymag_post_blocks_function' );

}

?>