<?php
// Set up the content width value based on the theme's design and stylesheet.
if ( ! isset( $content_width ) )
    $content_width = 625;

if ( ! function_exists( 'nm_elysium_setup' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 */
function nm_elysium_setup() {

    /*
     * Make theme available for translation.
     * Translations can be filed in the /languages/ directory.
     */
    load_theme_textdomain( 'sparkling', get_template_directory() . '/languages' );

    // Add default posts and comments RSS feed links to head.
    add_theme_support( 'automatic-feed-links' );

    /*
     * Enable support for Post Thumbnails on posts and pages.
     *
     * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
     */
    add_theme_support( 'post-thumbnails' );
    add_image_size('home-featured', 360, 200, true);

    $args = array(
        'default-image' => get_template_directory_uri() . '/images/header.png',
        'uploads'       => true,
    );
    add_theme_support( 'custom-header', $args );


    // the_excerpt Settings
    remove_filter('the_excerpt', 'wpautop');

    // This theme uses wp_nav_menu() in one location.
    register_nav_menus(
        array('top' => 'Theme Top Menu')
    );

    // Setup the WordPress core custom background feature.
    add_theme_support( 'custom-background', apply_filters( 'nm_slice_custom_background_args', array(
        'default-color' => 'F2F2F2',
        'default-image' => '',
    ) ) );
}
endif; // nm_elysium_setup
add_action( 'after_setup_theme', 'nm_elysium_setup' );	

/**
 * Adjust content width in certain contexts.
 *
 * Adjusts content_width value for full-width and single image attachment
 * templates, and when there are no active widgets in the sidebar.
 *
 * @since Twenty Twelve 1.0
 *
 * @return void
 */
function elysium_content_width() {
    if ( is_attachment() || ! is_active_sidebar( 'sidebar-1' ) ) {
        global $content_width;
        $content_width = 960;
    }
}
add_action( 'template_redirect', 'elysium_content_width' );

    // Load Styles    
    function nm_elysium_scripts() {
        wp_enqueue_script('custom-script',get_template_directory_uri() . '/js/script.js',array( 'jquery' ));

        wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css');
        wp_enqueue_script('bootstrap-js',get_template_directory_uri() . '/js/bootstrap.min.js');
    }

    add_action( 'wp_enqueue_scripts', 'nm_elysium_scripts' );


    function custom_excerpt_length( $length ) {
        return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    function new_excerpt_more( $more ) {
        return '...';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
	// Declare sidebar widget zone
    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    		'name' => 'Home Widgets',
    		'id'   => 'home-widgets',
    		'description'   => 'These are widgets for the homepage.',
    		'before_widget' => '<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4"><div class="panel panel-default custom-panel">',
    		'after_widget'  => '</div></div>',
    		'before_title'  => '<div class="panel-heading"><h3>',
    		'after_title'   => '</h3></div>'
    	));

        register_sidebar(array(
            'name' => 'Sidebar Widgets',
            'id'   => 'sidebar-widgets',
            'description'   => 'These are widgets for the sidebar.',
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget'  => '</div>',
            'before_title'  => '<h2>',
            'after_title'   => '</h2>'
        ));
        // Footer Widgets
        register_sidebar(array(
            'name' => 'Footer Box 1',
            'id'   => 'footer-box-1',
            'description'   => 'These are widgets for the footer box 1.',
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '<h3>',
            'after_title'   => '</h3>'
        ));
 
        register_sidebar(array(
            'name' => 'Footer Box 2',
            'id'   => 'footer-box-2',
            'description'   => 'These are widgets for the footer box 2.',
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '<h3>',
            'after_title'   => '</h3>'
        ));
 
        register_sidebar(array(
            'name' => 'Footer Box 3',
            'id'   => 'footer-box-3',
            'description'   => 'These are widgets for the footer box 3.',
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '<h3>',
            'after_title'   => '</h3>'
        ));
 
 
        register_sidebar(array(
            'name' => 'Footer Box 4',
            'id'   => 'footer-box-4',
            'description'   => 'These are widgets for the footer box 4.',
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '<h3>',
            'after_title'   => '</h3>'
        ));
        
    }

?>