<?php
/*============*****************/
if(!function_exists('webhosty_search_form')){  
	function webhosty_search_form( $form ) {  
		$form =	'<form  role="search" method="get" action="' .esc_url(home_url( '/' )) . '" >
		  <fieldset>  
		  <p class="input-a">
		  <input type="text" id="gfa" name="' .__('s','webhosty').'" value="'.get_search_query(). '" placeholder="'.__('Search ...','webhosty').'" > 
            <button type="submit">'.__('Search','webhosty').'</button>
		    </p>
		</fieldset>   
		</form>';
		return $form;
	} 
}
add_filter( 'get_search_form', 'webhosty_search_form' );
/*********=============== Get Fixed Content ============*****************/
if(!function_exists('get_excerpt')){
	function get_excerpt($count){
	  global $post;
	  $permalink = get_permalink($post->ID);
	  $excerpt = get_the_content();
	  $excerpt = strip_tags($excerpt);
	  $excerpt = substr($excerpt, 0, $count);
	  $excerpt = substr($excerpt, 0, strripos($excerpt, " "));
	  $excerpt = $excerpt.'... ';
	  return $excerpt; 
	}
}  
/*********=============== Header ============*****************/
add_action('wp_head','customcss_webhostyoption');
if(!function_exists('customcss_webhostyoption')){
	function customcss_webhostyoption(){
		global $webh_data;
		$css = $webh_data['webhosty_customcss'];
		$css_output = "<!-- Custom CSS -->\n<style type=\"text/css\">\n" . $css . "\n</style>";
		if(!empty($css)) {
			echo $css_output;
		} 
	}
}
/*********=============== Sidebar ============*****************/
if(!function_exists('webhosty_sidebar')){
	function webhosty_sidebar(){
		echo '<div class="col-sm-3"><aside class="aside">';
	                       get_sidebar();    
                       echo ' </aside> 
                    </div> ';
	}
} 

/*********=============== add span in widget category ============*****************/
add_filter('wp_list_categories', 'cat_count_span_inline');   
function cat_count_span_inline($output) {
$output = str_replace('</a> (','<span> ',$output);
$output = str_replace(')','</span></a> ',$output);
return $output; 
} 
add_filter('the_tags', 'wp32234_add_span_get_the_tag_list');

function wp32234_add_span_get_the_tag_list($list) {
    $list = str_replace('rel="tag">', 'rel="tag" class="tag">', $list);
    $list = str_replace('</a>', '</a>', $list); 
    return $list;
}
/*********=============== Post count ============*****************/
function observePostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
?>