<?php
/**
 * litniNG Class
 *
 * Do not modify this code, please use a child theme to make changes.
 *
 * @package WordPress
 * @subpackage litniNG
 * @since 1.0
 * @version 1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'litniNG' ) ) :

	class litniNG {

		public function __construct() {
			add_action( 'after_setup_theme',          array( $this, 'setup' ) );
			add_action( 'widgets_init',               array( $this, 'widgets_init' ) );
			add_action( 'wp_enqueue_scripts',         array( $this, 'scripts' ),       10 );
            add_action( 'admin_init',                 array( $this, 'add_editor_styles' ) );
		}

		public function setup() {

			load_theme_textdomain( 'litning', trailingslashit( WP_LANG_DIR ) . 'themes/' );

			load_theme_textdomain( 'litning', get_stylesheet_directory() . '/languages' );

			load_theme_textdomain( 'litning', get_template_directory() . '/languages' );

			add_theme_support( 'automatic-feed-links' );
            
            add_theme_support( 'title-tag' );

			add_theme_support( 'post-thumbnails' );
            
            add_image_size( 'litning-thumb', 120, 120, array( 'canter', 'center' ) );
            add_image_size( 'litning-single', 1344, 500, array( 'canter', 'center' ) );

			add_theme_support( 'custom-logo', array(
                'width'       => 32,
                'height'      => 32,
            ) );

			register_nav_menus( array(
                'primary' => esc_html__( 'Primary Menu', 'litning' ),
                'social' => esc_html__( 'Social Menu', 'litning' ),
            ) );

			add_theme_support( 'html5', array(
                'search-form',
                'comment-form',
                'comment-list',
                'gallery',
                'caption',
            ) );

			add_theme_support( 'custom-background', apply_filters( 'litning_custom_background_args', array(
                'default-color' => 'ffffff',
                'default-image' => '',
            ) ) );

			add_theme_support( 'customize-selective-refresh-widgets' );
            
            add_theme_support( 'post-formats', array( 'aside' ) );
            
		}

		public function widgets_init() {
			
			register_sidebar( array(
                'name'          => esc_html__( 'Main Sidebar', 'litning' ),
                'id'            => 'sidebar-main',
                'description'   => esc_html__( 'Widgets added here will appear in the sidebar.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'After Header 1', 'litning' ),
                'id'            => 'header-1',
                'description'   => esc_html__( 'Widgets added here will appear in column 1 of the after header area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h2 class="widget-title">',
                'after_title'   => '</h2>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'After Header 2', 'litning' ),
                'id'            => 'header-2',
                'description'   => esc_html__( 'Widgets added here will appear in column 2 of the after header area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h2 class="widget-title">',
                'after_title'   => '</h2>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'After Header 3', 'litning' ),
                'id'            => 'header-3',
                'description'   => esc_html__( 'Widgets added here will appear in column 3 of the after header area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h2 class="widget-title">',
                'after_title'   => '</h2>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'First Post', 'litning' ),
                'id'            => 'sidebar-post',
                'description'   => esc_html__( 'Widgets added here will appear after the first post on the home page.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h2 class="widget-title">',
                'after_title'   => '</h2>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Footer 1', 'litning' ),
                'id'            => 'footer-1',
                'description'   => esc_html__( 'Widgets added here will appear in column 1 of the footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Footer 2', 'litning' ),
                'id'            => 'footer-2',
                'description'   => esc_html__( 'Widgets added here will appear in column 2 of the footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Footer 3', 'litning' ),
                'id'            => 'footer-3',
                'description'   => esc_html__( 'Widgets added here will appear in column 3 of the footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Not Found 1', 'litning' ),
                'id'            => 'not-found-1',
                'description'   => esc_html__( 'Widgets added here will appear in column 1 of the 404 page footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Not Found 2', 'litning' ),
                'id'            => 'not-found-2',
                'description'   => esc_html__( 'Widgets added here will appear in column 2 of the 404 page footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            register_sidebar( array(
                'name'          => esc_html__( 'Not Found 3', 'litning' ),
                'id'            => 'not-found-3',
                'description'   => esc_html__( 'Widgets added here will appear in column 3 of the 404 page footer area.', 'litning' ),
                'before_widget' => '<section id="%1$s" class="widget %2$s">',
                'after_widget'  => '</section>',
                'before_title'  => '<h3 class="widget-title">',
                'after_title'   => '</h3>',
            ) );
            
		}

		public function scripts() {
			wp_enqueue_style( 'litning-style', get_stylesheet_uri() );
            wp_enqueue_style( 'litning-genericons', get_template_directory_uri() . '/assets/genericons/genericons.css', array(), '3.4.1' );
            wp_enqueue_script( 'litning-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20151215', true );
            wp_enqueue_script( 'litning-scroll-to-top', get_template_directory_uri() . '/assets/js/scroll-to-top.js', array( 'jquery' ), '20151204', true );
            wp_enqueue_script( 'litning-responsive-video', get_template_directory_uri() . '/assets/js/fluidvids.js', array(), 'false', true );
            wp_enqueue_script( 'litning-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true );
            if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
                wp_enqueue_script( 'comment-reply' );
            }
		}

        function add_editor_styles() {
            add_editor_style();
        }
        
    }

endif;

return new litniNG();
