<?php
/*
==========================================================

FUNCTION !!!

==========================================================
*/



function GoAwesomeGreen_script_enqueue() {
	// custom admin style sheet
	wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/awesome.css', array(), '1.0.0', 'all');
	wp_enqueue_style('responsivestyle', get_template_directory_uri() . '/css/responsive.css', array(), '1.0.0', 'all');
	wp_enqueue_style( 'google-fonts', 'http://fonts.googleapis.com/css?family=Ubuntu:700|Pacifico|Bad+Script|Belleza|Lobster', false );  
	// custom admin script
	wp_enqueue_script('customjs', get_template_directory_uri() . '/js/awesome.js', array(), '1.0.0', true);
	if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
	function my_jquery_enqueue() {
	   wp_deregister_script('jquery');
	   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js", false, null);
	   wp_enqueue_script('jquery');
	}
}

add_action( 'wp_enqueue_scripts', 'GoAwesomeGreen_script_enqueue' );

/*
==========================================================

THEME FUNCTION

==========================================================
*/

function GoAwesomeGreen_theme_setup() {

	add_theme_support('menus');

	register_nav_menu('primary', 'Primary Header Navigation');
	register_nav_menu('secondary', 'Footer Navigation');
}

add_action('init', 'GoAwesomeGreen_theme_setup');

add_theme_support('custom-background');

add_theme_support('custom-header');

add_theme_support('post-thumbnails');

add_theme_support('post-formats', array('aside', 'image'));

add_theme_support('html5', array('search-form'));

add_theme_support( 'automatic-feed-links' );

/*
==========================================================

WIDGET FUNCTION

==========================================================
*/

function GoAwesomeGreen_widget_setup(){
	register_sidebar(array(
			'name'	=> 'Footer widget',
			'id'	=> 'widget-1',
			'class'	=> 'custom',
			'description' => 'Widget Footer',
			'before_widget'	=> '<ul id="%1$s" class="widget %2$s">',
			'after_widget'	=> '</ul>',
			'before_title'	=> '<h3 class="widget-title">',
			'after_title'	=> '</h3>',	
		)
	);
	register_sidebar(array(
			'name'	=> 'Navigation Sidebar widget',
			'id'	=> 'widget-2',
			'class'	=> 'custom-1',
			'description' => 'Widget navigation bar',
			'before_widget'	=> '<ul id="%1$s" class="widget %2$s">',
			'after_widget'	=> '</ul>',
			'before_title'	=> '<h3 class="widget-title">',
			'after_title'	=> '</h3>',	
		)
	);
	register_sidebar(array(
			'name'	=> 'Header widget',
			'id'	=> 'widget-3',
			'class'	=> 'custom-3',
			'description' => 'Widget Header',
			'before_widget'	=> '<ul id="%1$s" class="widget %2$s">',
			'after_widget'	=> '</ul>',
			'before_title'	=> '<h3 class="widget-title">',
			'after_title'	=> '</h3>',	
		)
	);
}
add_action('widgets_init','GoAwesomeGreen_widget_setup');

/*
==========================================================

HEADER FUNCTION

==========================================================
*/
function GoAwesomeGreen_remove_version(){
	return '';
}
add_filter('the_generator', 'GoAwesomeGreen_remove_version');



/**
 * Filters the page title appropriately depending on the current page
 *
 * This function is attached to the 'wp_title' fiilter hook.
 *
 * @uses	get_bloginfo()
 * @uses	is_home()
 * @uses	is_front_page()
 */
/**
 * Creates a nicely formatted and more specific title element text
 * for output in head of document, based on current view.
 *
 * @param string $title Default title text for current view.
 * @param string $sep   Optional separator.
 * @return string Filtered title.
 */
function GoAwesomeGreen_filter_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', '' ), max( $paged, $page ) );
 
    return $title;
}
add_filter( 'wp_title', 'GoAwesomeGreen_filter_wp_title', 10, 2 );

if ( ! isset( $content_width ) ) {
	$content_width = 900;
}

function GoAwesomeGreen_enqueue_comments_reply() {
if( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'comment_form_before', 'GoAwesomeGreen_enqueue_comments_reply' );


function GoAwesomeGreen_add_editor_styles() {
    add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'GoAwesomeGreen_add_editor_styles' );





?>