<?php

// Disable direct call
if ( ! defined( 'ABSPATH' ) ) { exit; }


/* Theme setup section
-------------------------------------------------------------------- */

if ( !function_exists( 'seohub_template_plain_theme_setup' ) ) {
	add_action( 'seohub_action_before_init_theme', 'seohub_template_plain_theme_setup', 1 );
	function seohub_template_plain_theme_setup() {
		seohub_add_template(array(
			'layout' => 'plain',
			'template' => 'plain',
			'need_terms' => true,
			'mode'   => 'blogger',
			'title'  => esc_html__('Blogger layout: Plain', 'seohub'),
            'thumb_title'  => esc_html__('Wide image (crop)', 'seohub'),
            'w'		 => 830,
            'h'		 => 160
			));
	}
}

// Template output
if ( !function_exists( 'seohub_template_plain_output' ) ) {
	function seohub_template_plain_output($post_options, $post_data) {
		?>
		<div class="post_item sc_blogger_item sc_plain_item<?php echo ($post_options['number'] == $post_options['posts_on_page'] && !seohub_param_is_on($post_options['loadmore']) ? ' sc_blogger_item_last' : ''); ?>">


			<?php
            if ($post_data['post_video'] || $post_data['post_audio'] || $post_data['post_thumb'] ||  $post_data['post_gallery']) { ?>
                <div class="post_featured">
                    <?php require seohub_get_file_dir('templates/_parts/post-featured.php'); ?>
                </div>
            <?php }

			if (!empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms_links)) {
				?>
				<div class="post_category">
					<span class="post_category_label"><?php esc_html_e('in', 'seohub'); ?></span> <?php echo join(', ', $post_data['post_terms'][$post_data['post_taxonomy']]->terms_links); ?>
				</div>
				<?php
			}

			if (!isset($post_options['links']) || $post_options['links']) { 
				?><h3 class="post_title"><a href="<?php echo esc_url($post_data['post_link']); ?>"><?php echo trim($post_data['post_title']); ?></a></h3><?php
			} else {
				?><h3 class="post_title"><?php echo trim($post_data['post_title']); ?></h3><?php
			}
			
			if (!$post_data['post_protected'] && $post_options['info']) {
                $show_likes = true;
				$info_parts = array('counters'=>true, 'terms'=>false, 'author' => false);
				require seohub_get_file_dir('templates/_parts/post-info.php');
			}
			?>

		</div>		<!-- /.post_item -->

		<?php
	}
}
?>