<?php

if ( ! function_exists( 'effect_post_image' ) ) :
/**
 * Displays the featured image on archive posts.
 *
 * @param string $size Post thumbnail size.
 * @param array  $attr Post thumbnail attributes.
 */
function effect_post_image( $size = 'defaultthumb', $attr = array() ) {

	// Display Post Thumbnail.
	if ( has_post_thumbnail() ) : ?>
<div class="thumbnail">
		<a href="<?php the_permalink(); ?>" rel="bookmark">
			<?php the_post_thumbnail( $size, $attr ); ?>		
		</a>
</div>

	<?php endif;

} // effect_post_image()
endif;
		
if ( ! function_exists( 'effect_meta_author' ) ) :
/**
 * Displays the post author
 */
function effect_meta_author() {

	$author_string = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( esc_html__( 'View all posts by %s', 'effect' ), get_the_author() ) ),
		esc_html( get_the_author() )
	);

	return '<span class="meta-author"> ' . $author_string . '</span>';

}  // effect_meta_author()
endif;		
		
if ( ! function_exists( 'effect_meta_date' ) ) :
/**
 * Displays the post date
 */
function effect_meta_date() {

	$time_string = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date published updated" datetime="%3$s">%4$s</time></a>',
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() )
	);

	return '<span class="meta-date">' . $time_string . '</span>';

}  // effect_meta_date()
endif;

function effect_post_meta_data() {
	printf( __( '%2$s  %4$s', 'effect' ),
	'meta-prep meta-prep-author posted', 
	sprintf( '<time itemprop="datePublished" class="timestamp published updated">%3$s</time>',
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		esc_html( get_the_date() )
	),
	'byline',
	sprintf( '<span class="author vcard" itemprop="author" itemtype="http://schema.org/Person"><span class="fn">%3$s</span></span>',
		get_author_posts_url( get_the_author_meta( 'ID' ) ),
		sprintf( esc_attr__( 'View all posts by %s', 'effect' ), get_the_author() ),
		esc_attr( get_the_author() )
		)
	);
}



if ( ! function_exists( 'effect_post_navigation' ) ) :
/**
 * Displays Single Post Navigation
 */
function effect_post_navigation() {


	if ( of_get_option('effect_links' ) =='on') {

		the_post_navigation( array(
			'prev_text' => '<span class="screen-reader-text">' . esc_html_x( 'Previous Post:', 'post navigation', 'effect' ) . '</span>%title',
			'next_text' => '<span class="screen-reader-text">' . esc_html_x( 'Next Post:', 'post navigation', 'effect' ) . '</span>%title',
		) );

	}

}
endif;


if ( ! function_exists( 'effect_site_logo' ) ) :
/**
 * Displays the site logo in the header area
 */
function effect_site_logo() {

	if ( function_exists( 'the_custom_logo' ) ) {

		the_custom_logo();

	}

}
endif;


if ( ! function_exists( 'effect_site_title' ) ) :
/**
 * Displays the site title in the header area
 */
function effect_site_title() {


	if ( is_front_page() && is_home() ) : ?>

		<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>

	<?php else : ?>

		<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>

	<?php endif;

}
endif;

if ( ! function_exists( 'effect_site_description' ) ) :
/**
 * Displays the site description in the header area
 */
function effect_site_description() {


	$description = get_bloginfo( 'description', 'display' ); /* WPCS: xss ok. */

	if ( $description || is_customize_preview() ) : ?>

		<p class="site-description"><?php echo $description; ?></p>

	<?php
	endif;

}
endif;

if ( ! function_exists( 'effect_entry_tags' ) ) :
/**
 * Displays the post tags on single post view
 */
function effect_entry_tags() {

if(get_the_tag_list()) {
	// Get tags.
	$tag_list = get_the_tag_list( '', '' );

	// Display tags.
	if ( of_get_option('effect_tags' ) =='1') : ?>

		<div class="entry-tags clearfix">
			<span class="tags">
				<?php echo $tag_list; ?>
			</span>
		</div><!-- .entry-tags -->

	<?php
	endif;
}

} // effect_entry_tags()
endif;
/*
* Seach Form
*/

function effect_search_form( $form ) {
	$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
	<div><label class="screen-reader-text" for="s">' . __( 'Search for:','effect' ) . '</label>
	<input type="text" placeholder="'. esc_attr__( 'Search..','effect' ) .'" value="' . get_search_query() . '" name="s" id="s" />
	<input type="submit" id="searchsubmit" value="'. esc_attr__( 'Go','effect' ) .'" />
	</div>
	</form>';

	return $form;
}

add_filter( 'get_search_form', 'effect_search_form' );