<?php
/**
 * Custom template tags for Odin.
 *
 * @package Odin
 * @since 2.2.0
 */

if ( ! function_exists( 'odin_classes_page_full' ) ) {

	/**
	 * Classes page full.
	 *
	 * @since 2.2.0
	 *
	 * @return string Classes name.
	 */
	function odin_classes_page_full() {
		return 'col-md-12';
	}
}

if ( ! function_exists( 'odin_classes_page_sidebar' ) ) {

	/**
	 * Classes page with sidebar.
	 *
	 * @since 2.2.0
	 *
	 * @return string Classes name.
	 */
	function odin_classes_page_sidebar() {
		return 'col-md-9';
	}
}

if ( ! function_exists( 'odin_classes_page_sidebar_aside' ) ) {

	/**
	 * Classes aside of page with sidebar.
	 *
	 * @since 2.2.0
	 *
	 * @return string Classes name.
	 */
	function odin_classes_page_sidebar_aside() {
		return 'col-md-3 hidden-xs hidden-print widget-area';
	}
}

if ( ! function_exists( 'odin_posted_on' ) ) {

	/**
	 * Print HTML with meta information for the current post-date/time and author.
	 *
	 * @since 2.2.0
	 */
	function odin_posted_on() {
		if ( is_sticky() && is_home() && ! is_paged() ) {
			echo '<span class="featured-post">' . __( 'Sticky', 'morfeu' ) . ' </span>';
		}

		// Set up and print post meta information.
		printf( '<span class="entry-date"> <i class="icon-circle glyphicon glyphicon-calendar"></i> <time class="entry-date" datetime="%s">%s</time></span> <i class="icon-circle glyphicon glyphicon-user"></i> <span class="author vcard">' . __( 'By', 'morfeu' ) . ' <a class="url fn n" href="%s" rel="author">%s</a></span>',
			esc_attr( get_the_date( 'c' ) ),
			esc_html( get_the_date() ),
			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
			get_the_author()
		);

		printf(' <i class="icon-circle glyphicon glyphicon-comment"></i>');
		comments_number( __( '0 Comments', 'morfeu' ), __( '1 Comment', 'morfeu' ), __( '% Comments', 'morfeu' ) );

		printf(' <i class="icon-circle glyphicon glyphicon-folder-open"></i>');
		the_category( ', ' );
	}

	function odin_posted_small() {
		if ( is_sticky() && is_home() && ! is_paged() ) {
			echo '<span class="featured-post">' . __( 'Sticky', 'morfeu' ) . ' </span>';
		}

		// Set up and print post meta information.
		printf( '<span class="entry-date"> <i class="icon-circle glyphicon glyphicon-calendar"></i>&nbsp;<time class="entry-date" datetime="%s">%s</time></span>',
			esc_attr( get_the_date( 'c' ) ),
			esc_html( get_the_date() )
		);
	}
}

if ( ! function_exists( 'odin_paging_nav' ) ) {

	/**
	 * Print HTML with meta information for the current post-date/time and author.
	 *
	 * @since 2.2.0
	 */
	function odin_paging_nav() {
		$mid  = 2;     // Total of items that will show along with the current page.
		$end  = 1;     // Total of items displayed for the last few pages.
		$show = false; // Show all items.

		echo odin_pagination( $mid, $end, false );
	}
}