<?php 
/**
 * @version    0.0.8
 * @package    pikaxo
 * @author     Zidithemes
 * @copyright  Copyright (C) 2018 zidithemes.tumblr.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * 
 */


if ( ! defined( 'ABSPATH' ) ) { exit; }



function pikaxo_setup(){
	
		// ADD THEME SUPPORT
	add_theme_support( 'title-tag' );
	add_theme_support( 'automatic-feed-links' );
	add_theme_support( "custom-header" );
	add_theme_support( "custom-background" );
	add_theme_support( 'post-thumbnails' );
	add_theme_support('woocommerce');


	// ADD EDITOR STYLE
	add_editor_style();

	//REGISTER NAV MENUS
	register_nav_menus(
	    array(
	      'primary-menu' => __( 'Primary Menu', 'pikaxo' ),
	    )
	  );


	load_theme_textdomain( 'pikaxo' );


}

add_action('after_setup_theme', 'pikaxo_setup');


//Load styles
function pikaxo_load_styles_scripts(){
	//NOTE:   SOME OF THESE SCRIPTS ARE HOSTED ON A CDN AND ARE NOT STORED LOCALLY... SO THIS THEME MAY NOT RENDER PROPERLY IF YOU ARE NOT CONNECTED TO THE INTERNET
	
	//wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
		wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css');

	
}

add_action('wp_enqueue_scripts', 'pikaxo_load_styles_scripts');



//SET CONTENT WIDTH
if ( ! isset( $content_width ) ) $content_width = 600;





//Creating the sidebar
function pikaxo_menu_init() {


register_sidebar(
		array(
                'name' 			=> __('Sidebar Widgets', 'pikaxo'),
                'id'   			=> 'sidebar-widgets',
                'class' 		=> '',
				'description' 	=> __('Add sidebar widgets here', 'pikaxo'),
		'before_widget' 		=> '<div class="sidebar-items">',
		'after_widget' 			=> '</div>',
		'before_title' 			=> '<h2>',
		'after_title' 			=> '</h2>',
	));


	register_sidebar(array(
                'name' 			=> __('Left Footer', 'pikaxo'),
                'id'   			=> 'left-footer',
                'class' 		=> '',
				'description' 	=> __('Add widgets here', 'pikaxo'),
		'before_widget' 		=> '<li>',
		'after_widget' 			=> '</li>',
		'before_title' 			=> '<h2>',
		'after_title' 			=> '</h2>',
	));
	
	register_sidebar(array(
                'name' 			=> __('Middle Footer', 'pikaxo'),
                'id'   			=> 'middle-footer',
                'class' 		=> '',
				'description' 	=> __('Add widgets here', 'pikaxo'),
		'before_widget' 		=> '<li>',
		'after_widget' 			=> '</li>',
		'before_title' 			=> '<h2>',
		'after_title' 			=> '</h2>',
	));
	
	register_sidebar(array(
                'name' 			=> __('Right Footer', 'pikaxo'),
                'id'   			=> 'right-footer',
                'class' 		=> '',
				'description' 	=> __('Add widgets here', 'pikaxo'),
		'before_widget' 		=> '<li>',
		'after_widget' 			=> '</li>',
		'before_title' 			=> '<h2>',
		'after_title' 			=> '</h2>',
	));
	
	register_sidebar(array(
                'name' 			=> __('Full Width Footer', 'pikaxo'),
                'id'  			=>  'full-width-footer',
                'class' 		=> '',
				'description' 	=> __('Add widgets here(Full width Footer)', 'pikaxo'),
		'before_widget' 		=> '<li>',
		'after_widget' 			=> '</li>',
		'before_title' 			=> '<h2>',
		'after_title' 			=> '</h2>',
	));

}
add_action('widgets_init', 'pikaxo_menu_init');



// this increases or decreaes the length of the excerpt on the index page
function pikaxo_excerpt_length( $length ) {
	return 40;
}
add_filter( 'excerpt_length', 'pikaxo_excerpt_length', 999 );

function pikaxo_excerpt_more( $more ) {
    //return 'More';
    return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'pikaxo') . '</a>';
}
add_filter( 'excerpt_more', 'pikaxo_excerpt_more' );


?>