<?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('nomad_press_after_content_meta_function')) {

	function nomad_press_after_content_meta_function() {

		if ( get_post_type() !== 'post' ) {
			return;
		}

		$show_category = ( avventura_lite_setting('nomad_press_enable_post_category', true) == true );
		$show_icon = ( avventura_lite_setting('nomad_press_enable_post_icon', true) == true );
		$show_date = ( avventura_lite_setting('nomad_press_enable_post_date', true) == true );
		$show_author = ( avventura_lite_setting('nomad_press_enable_post_author', true) == true );
		$show_comments = comments_open() || get_comments_number();

		if ( ! $show_category && ! $show_icon && ! $show_date && ! $show_author && ! $show_comments ) {
			return;
		}

		global $post;

		echo '<div class="line"><div class="entry-info">';

			if ( $show_date ) {
				echo '<span><i class="fa fa-clock-o"></i>' . esc_html(get_the_date()) . '</span>';
			}

			if ( $show_comments ) {
				echo '<span><i class="fa fa-comments-o"></i>';
				comments_number(
					'<a href="' . esc_url(get_permalink($post->ID)) . '#respond">' . esc_html__( '0 comments', 'nomad-press' ) . '</a>',
					'<a href="' . esc_url(get_permalink($post->ID)) . '#comments">1 ' . esc_html__( 'comment', 'nomad-press' ) . '</a>',
					'<a href="' . esc_url(get_permalink($post->ID)) . '#comments">% ' . esc_html__( 'comments', 'nomad-press' ) . '</a>'
				);
				echo '</span>';
			}

			if ( $show_icon ) {
				echo nomad_press_post_icon();
			}

			if ( $show_category && has_category() ) {
				echo '<span><i class="fa fa-tags"></i>';
				the_category(', ');
				echo '</span>';
			}

			if ( $show_author ) {
				echo '<span><i class="fa fa-user"></i>' . esc_html(avventura_lite_setting('nomad_press_post_author_label', __( ' by ', 'nomad-press' ))) . wp_kses_post(get_the_author_posts_link()) . '</span>';
			}

		echo '</div></div>';

	}

	add_action( 'avventura_lite_after_content', 'nomad_press_after_content_meta_function', 5 );

}

?>
