<?php

/**

 * Custom template tags for Tribute

 *

 * Eventually, some of the functionality here could be replaced by core features.

 *

 * @package WordPress

 * @subpackage Tribute

 * @since Tribute 1.0

 */

define('TRIBUTE_POST_CONTENT_LENGTH', 40);

if(!function_exists('tribute_comment_nav')) :



function tribute_comment_nav() {
// Are there comments to navigate through?
if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
?>
<nav class="navigation comment-navigation" role="navigation">
    <h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'tribute' ); ?></h2>
    <div class="nav-links">
        <?php
            if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'tribute' ) ) ) :
                printf( '<div class="nav-previous">%s</div>', $prev_link );
            endif;

 
            if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'tribute' ) ) ) :
                printf( '<div class="nav-next">%s</div>', $next_link );
            endif;
        ?>
    </div><!-- .nav-links -->
</nav><!-- .comment-navigation -->
<?php
endif;

}

endif;





if ( ! function_exists( 'tribute_post_thumbnail')) :

/**

 * Display an optional post thumbnail.

 *

 * Wraps the post thumbnail in an anchor element on index views, or a div

 * element when on single views.

 *

 * @since Tribute 1.0

 */

function tribute_post_thumbnail() {

	if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {

		return;

	}



	if ( is_singular() ) :

	?>



	<div class="entry-summary">

		<?php the_post_thumbnail(); ?>

	</div><!-- .post-thumbnail -->



	<?php else : ?>



	<a href="<?php the_permalink(); ?>">

		<?php

			the_post_thumbnail('post-thumbnail', array( 'alt' => get_the_title() ));

		?>

	</a>



	<?php endif; // End is_singular()

}

endif;



if(!function_exists( 'tribute_post_title')) : 
function tribute_post_title()
{
  if ( is_single() ) :

 ?>
      <?php the_title(); ?>
      <?php else: ?>
      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endif; 
}

endif;




/**
 * Clean up the_excerpt()
 */
function tribute_excerpt_length($length) {
  return TRIBUTE_POST_CONTENT_LENGTH;
}

function tribute_remove_more_link_scroll( $link ) {
  $link = preg_replace( '|#more-[0-9]+|', '', $link );
  return $link;
}
add_filter( 'the_content_more_link', 'tribute_remove_more_link_scroll' );

function tribute_excerpt_more($more) {
  return ' [&hellip;]';
}
add_filter('excerpt_length', 'tribute_excerpt_length',999);
add_filter('excerpt_more', 'tribute_excerpt_more');
add_action('tribute_footer_action', 'tribute_footer_layout');
function tribute_footer_layout()
{$footer_icon_style=get_theme_mod('footer_icon_style');?>
<?php if(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_a'){?>
<div class="col-md-6 col-sm-6 col-xs-12">
  <?php if ( get_theme_mod( 'copyright_textbox')) : ?> 
  <p><?php echo esc_html(get_theme_mod('copyright_textbox')); ?></p>
  <?php else : $footertext = '[copyright] [the-year] [site-name] [theme-credit]';
       $footertext = str_replace('[copyright]','&copy;',$footertext);
       $footertext = str_replace('[the-year]',date('Y'),$footertext);
       $footertext = str_replace('[site-name]',get_bloginfo('name'),$footertext);
       $footertext = str_replace('[theme-credit]','- WordPress Theme by <a href="'.esc_url( __( 'http://www.ydesignservices.com/', 'tribute' ) ).'" target="_blank">Y Design Services</a>',$footertext);
        echo '<p>'.do_shortcode($footertext).'</p>'; endif; ?>
    </div>
<div class="col-md-6 col-sm-6 col-xs-12"><?php tribute_social_media_icons(); ?> </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_b'){?>
<div class="col-md-6 col-sm-6 col-xs-12 common-left"><?php tribute_social_media_icons(); ?> </div>
<div class="col-md-6 col-sm-6 col-xs-12 common-right">
  <?php if ( get_theme_mod( 'copyright_textbox')) : ?> 
  <p><?php echo esc_html(get_theme_mod('copyright_textbox')); ?></p>
  <?php else : $footertext = '[copyright] [the-year] [site-name] [theme-credit]';
       $footertext = str_replace('[copyright]','&copy;',$footertext);
       $footertext = str_replace('[the-year]',date('Y'),$footertext);
       $footertext = str_replace('[site-name]',get_bloginfo('name'),$footertext);
       $footertext = str_replace('[theme-credit]','- WordPress Theme by <a href="'.esc_url( __( 'http://www.ydesignservices.com/', 'tribute' ) ).'" target="_blank">Y Design Services</a>',$footertext);
        echo '<p>'.do_shortcode($footertext).'</p>'; endif; ?>
    </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_c'){?>
<div class="col-md-6 col-sm-6 col-xs-12 common-left">
  <?php if ( get_theme_mod( 'copyright_textbox')) : ?> 
  <p><?php echo esc_html(get_theme_mod('copyright_textbox')); ?></p>
  <?php else : $footertext = '[copyright] [the-year] [site-name] [theme-credit]';
       $footertext = str_replace('[copyright]','&copy;',$footertext);
       $footertext = str_replace('[the-year]',date('Y'),$footertext);
       $footertext = str_replace('[site-name]',get_bloginfo('name'),$footertext);
       $footertext = str_replace('[theme-credit]','- WordPress Theme by <a href="'.esc_url( __( 'http://www.ydesignservices.com/', 'tribute' ) ).'" target="_blank">Y Design Services</a>',$footertext);
        echo '<p>'.do_shortcode($footertext).'</p>'; endif; ?>
    </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_d'){?>
<div class="col-md-12 col-sm-12 col-xs-12 common-right">
  <?php if ( get_theme_mod( 'copyright_textbox')) : ?> 
  <p><?php echo esc_html(get_theme_mod('copyright_textbox')); ?></p>
  <?php else : $footertext = '[copyright] [the-year] [site-name] [theme-credit]';
       $footertext = str_replace('[copyright]','&copy;',$footertext);
       $footertext = str_replace('[the-year]',date('Y'),$footertext);
       $footertext = str_replace('[site-name]',get_bloginfo('name'),$footertext);
       $footertext = str_replace('[theme-credit]','- WordPress Theme by <a href="'.esc_url( __( 'http://www.ydesignservices.com/', 'tribute' ) ).'" target="_blank">Y Design Services</a>',$footertext);
        echo '<p>'.do_shortcode($footertext).'</p>'; endif; ?>
    </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_e'){?>
<div class="col-md-6 col-sm-6 col-xs-12 common-left"><?php tribute_social_media_icons(); ?> </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_f'){?>
<div class="col-md-12 col-sm-12 col-xs-12 common-right"><?php tribute_social_media_icons(); ?> </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_g'){?>
<div class="col-md-12 col-sm-12 col-xs-12 common-center">
  <?php if ( get_theme_mod( 'copyright_textbox')) : ?> 
  <p><?php echo esc_html(get_theme_mod('copyright_textbox')); ?></p>
  <?php else : $footertext = '[copyright] [the-year] [site-name] [theme-credit]';
       $footertext = str_replace('[copyright]','&copy;',$footertext);
       $footertext = str_replace('[the-year]',date('Y'),$footertext);
       $footertext = str_replace('[site-name]',get_bloginfo('name'),$footertext);
       $footertext = str_replace('[theme-credit]','- WordPress Theme by <a href="'.esc_url( __( 'http://www.ydesignservices.com/', 'tribute' ) ).'" target="_blank">Y Design Services</a>',$footertext);
        echo '<p>'.do_shortcode($footertext).'</p>'; endif; ?>
    </div>
<?php }elseif(isset($footer_icon_style)&&$footer_icon_style=='footer_icon_h'){?>
<div class="col-md-12 col-sm-12 col-xs-12 common-centericon"><?php tribute_social_media_icons(); ?> </div>
<?php }?>
<?php }?>
<?php 
function tribute_hook_css() {
	$heading_h1=get_theme_mod('heading_h1');
	$heading_h2=get_theme_mod('heading_h2');
	$heading_h3=get_theme_mod('heading_h3');
	$heading_h4=get_theme_mod('heading_h4');
	$heading_h5=get_theme_mod('heading_h5');
	$heading_h6=get_theme_mod('heading_h6');
        ?>
            <style>
			  <?php if(isset($heading_h1)&&$heading_h1!==''){?>
                h1 {font-size:<?php echo esc_attr($heading_h1);?>px !important;}
				<?php }?>
				 <?php if(isset($heading_h2)&&$heading_h2!==''){?>
                h2 {font-size:<?php echo esc_attr($heading_h2);?>px !important;}
				<?php }?>
				 <?php if(isset($heading_h3)&&$heading_h3!==''){?>
                h3 {font-size:<?php echo esc_attr($heading_h3);?>px !important;}
				<?php }?>
				 <?php if(isset($heading_h4)&&$heading_h4!==''){?>
                h4 {font-size:<?php echo esc_attr($heading_h4);?>px !important;}
				<?php }?>
				 <?php if(isset($heading_h5)&&$heading_h5!==''){?>
                h5 {font-size:<?php echo esc_attr($heading_h5);?>px !important;}
				<?php }?>
				 <?php if(isset($heading_h6)&&$heading_h6!==''){?>
                h5 {font-size:<?php echo esc_attr($heading_h6);?>px !important;}
				<?php }?>
            </style>
        <?php
    }
add_action('wp_head', 'tribute_hook_css');