for posts and comments.
	add_theme_support( 'automatic-feed-links' );
	// Enable support for Post Thumbnails, and declare two sizes.
	add_theme_support( 'post-thumbnails' );
	set_post_thumbnail_size( 672, 372, true );
	add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
	// This theme uses wp_nav_menu() in two locations.
	register_nav_menus( array(
		'primary'   => __( 'Top primary menu', 'twentyfourteen' ),
		'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
	) );
	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'search-form',
		'comment-form',
		'comment-list',
	) );
}
endif; // twentyfourteen_setup
add_action( 'after_setup_theme', 'twentyfourteen_setup' );
/**
 * Enqueue scripts and styles for the front end.
 * @since Twenty Fourteen 1.0
 * @return void
 */
function twentyfourteen_scripts() {
	// Load our main stylesheet.
	wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() );
	// Load the Internet Explorer specific stylesheet.
	wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' );
	wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' );
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
	wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131209', true );
}
add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
/**
 * Extend the default WordPress body classes.
 * Adds body classes to denote:
 * 1. Single or multiple authors.
 * 2. Presence of header image.
 * 3. Index views.
 * 4. Full-width content layout.
 * 5. Presence of footer widgets.
 * 6. Single views.
 * 7. Featured content layout.
 * @since Twenty Fourteen 1.0
 * @param array $classes A list of existing body class values.
 * @return array The filtered body class list.
 */
function twentyfourteen_body_classes( $classes ) {
	if ( is_multi_author() ) {
		$classes[] = 'group-blog';
	}
	if ( is_archive() || is_search() || is_home() ) {
		$classes[] = 'list-view';
	}
	if ( is_singular() && ! is_front_page() ) {
		$classes[] = 'singular';
	}
	return $classes;
}
add_filter( 'body_class', 'twentyfourteen_body_classes' );
/**
 * Extend the default WordPress post classes.
 * Adds a post class to denote:
 * Non-password protected page with a post thumbnail.
 * @since Twenty Fourteen 1.0
 * @param array $classes A list of existing post class values.
 * @return array The filtered post class list.
 */
function twentyfourteen_post_classes( $classes ) {
	if ( ! post_password_required() && has_post_thumbnail() ) {
		$classes[] = 'has-post-thumbnail';
	}
	return $classes;
}
add_filter( 'post_class', 'twentyfourteen_post_classes' );
/**
 * Create a nicely formatted and more specific title element text for output
 * in head of document, based on current view.
 * @since Twenty Fourteen 1.0
 * @param string $title Default title text for current view.
 * @param string $sep Optional separator.
 * @return string The filtered title.
 */
function twentyfourteen_wp_title( $title, $sep ) {
	global $paged, $page;
	if ( is_feed() ) {
		return $title;
	}
	// Add the site name.
	$title .= get_bloginfo( 'name' );
	// Add the site description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) ) {
		$title = "$title $sep $site_description";
	}
	// Add a page number if necessary.
	if ( $paged >= 2 || $page >= 2 ) {
		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) );
	}
	return $title;
}
add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
function basic_template_scripts() {
    wp_deregister_script( 'jquery' ); // jQuery
    wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js' );
    wp_enqueue_script( 'jquery' );
    wp_deregister_script( 'jquery-ui' ); // jQuery UI
    wp_register_script( 'jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', array( 'jquery' ) );
    wp_enqueue_script( 'jquery-ui' );
    wp_deregister_script( 'nivoslider' ); // nivoSlider
    wp_register_script( 'nivoslider', get_bloginfo('template_directory') . '/js/jquery.nivo.slider.pack.js', array( 'jquery' ) );
    wp_enqueue_script( 'nivoslider' );
    wp_deregister_script( 'climatecontrol-js' ); // Example
    wp_register_script( 'climatecontrol-js', get_bloginfo('template_directory') . '/js/climatecontrol.js', array( 'jquery' ) );
    wp_enqueue_script( 'climatecontrol-js' );
	wp_register_style('nivoslider-css', get_bloginfo('template_directory') . '/css/nivo-slider.css');
	wp_enqueue_style('nivoslider-css');
}    
add_action('wp_enqueue_scripts', 'basic_template_scripts');
/* Limit string by words not characters */
function limit_words($string, $word_limit) { $words = explode(" ",$string); return implode(" ",array_splice($words,0,$word_limit)); }
function remove_menus () {
	global $menu;
	$restricted = array(__('Links'), __('Comments'));
	end ($menu);
	while (prev($menu)){
		$value = explode(' ',$menu[key($menu)][0]);
		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
	}
}
add_action('admin_menu', 'remove_menus');
add_action("login_head", "my_login_head");
function my_login_head() {
    echo " 
    
    ";
}
add_filter( 'login_headerurl', 'w4_login_headerurl');
function w4_login_headerurl(){
    return home_url('/');
}
function columns_one_third( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_third', 'columns_one_third');
function columns_one_third_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_third_last', 'columns_one_third_last');
function columns_two_third( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('two_third', 'columns_two_third');
function columns_two_third_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('two_third_last', 'columns_two_third_last');
function columns_one_half( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_half', 'columns_one_half');
function columns_one_half_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_half_last', 'columns_one_half_last');
function columns_one_fourth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_fourth', 'columns_one_fourth');
function columns_one_fourth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_fourth_last', 'columns_one_fourth_last');
function columns_three_fourth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('three_fourth', 'columns_three_fourth');
function columns_three_fourth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('three_fourth_last', 'columns_three_fourth_last');
function columns_one_fifth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_fifth', 'columns_one_fifth');
function columns_one_fifth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_fifth_last', 'columns_one_fifth_last');
function columns_two_fifth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('two_fifth', 'columns_two_fifth');
function columns_two_fifth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('two_fifth_last', 'columns_two_fifth_last');
function columns_three_fifth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('three_fifth', 'columns_three_fifth');
function columns_three_fifth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('three_fifth_last', 'columns_three_fifth_last');
function columns_four_fifth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('four_fifth', 'columns_four_fifth');
function columns_four_fifth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('four_fifth_last', 'columns_four_fifth_last');
function columns_one_sixth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_sixth', 'columns_one_sixth');
function columns_one_sixth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('one_sixth_last', 'columns_one_sixth_last');
function columns_five_sixth( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('five_sixth', 'columns_five_sixth');
function columns_five_sixth_last( $atts, $content = null ) { return '' . do_shortcode($content) . '
'; } add_shortcode('five_sixth_last', 'columns_five_sixth_last');
function columns_formatter($content) {
	$new_content = '';
	/* Matches the contents and the open and closing tags */
	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
	/* Matches just the contents */
	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
	/* Divide content into pieces */
	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
	/* Loop over pieces */
	foreach ($pieces as $piece) {
		/* Look for presence of the shortcode */
		if (preg_match($pattern_contents, $piece, $matches)) {
			/* Append to content (no formatting) */
			$new_content .= $matches[1];
		} else {
			/* Format and append to content */
			$new_content .= wptexturize(wpautop($piece));
		}
	}
	return $new_content;
}
// Remove the 2 main auto-formatters
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
// Before displaying for viewing, apply this function
add_filter('the_content', 'columns_formatter', 99);
add_filter('widget_text', 'columns_formatter', 99);
/* Pagination as found here: http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/ */
function pagination($pages = '', $range = 4)
{  
     $showitems = ($range * 2)+1;  
 
     global $paged;
     if(empty($paged)) $paged = 1;
 
     if($pages == '') {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if(!$pages) { $pages = 1; }
     }   
 
     if(1 != $pages)
     {
         echo "\n";
     }
}
/* Added by https://davidawindham.com */
/********************************************
 * Functions to clean up code output
*********************************************/
/****************
 * remove unnecessary items from the head
*****************/
remove_action('wp_head', 'index_rel_link' );
remove_action('wp_head', 'rel_canonical');
remove_action('wp_head', 'start_post_rel_link', 10, 0 );
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action('wp_head', 'parent_post_rel_link', 10, 0 );
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links_extra', 3 );
remove_action('wp_head', 'feed_links', 2 );
remove_action('wp_head', 'wp_oembed_add_discovery_links', 10, 0 );
remove_action('wp_head', 'wp_oembed_add_host_js', 10, 0 );
/****************
 * remove versions (?v=1.0.4 etc.) from javascript and css
*****************/
add_filter( 'style_loader_src', 'srh_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'srh_remove_wp_ver_css_js', 9999 );
function srh_remove_wp_ver_css_js( $src ) {
    if ( strpos( $src, 'ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
/****************
 * disable emojis
*****************/
add_action( 'init', 'disable_emojis' );
function disable_emojis_tinymce( $plugins ) {
  if ( is_array( $plugins ) ) {
    return array_diff( $plugins, array( 'wpemoji' ) );
  } else {
    return array();
  }
}
function disable_emojis() {
	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
	remove_action( 'wp_print_styles', 'print_emoji_styles' );
	remove_action( 'admin_print_styles', 'print_emoji_styles' );
	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
	add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action('init','avia_remove_debug');
function avia_remove_debug(){
	remove_action('wp_head','avia_debugging_info',1000);
	remove_action('admin_print_scripts','avia_debugging_info',1000);
}