<?php
/**
 * Theme functions and definitions
 *
 * @package Versatile Corporate
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

define( 'VERSATILE_CORPORATE_VERSION', '2.15' );
define( 'VERSATILE_CORPORATE_THEME_NAME', 'Versatile Corporate' );
define( 'VERSATILE_CORPORATE_THEME_SLUG', 'versatile-corporate' );

if ( ! function_exists( 'versatile_corporate_setup' ) ) {

    function versatile_corporate_setup() {
        register_nav_menus( array(
            'primary' => __( 'Primary Menu', 'versatile-corporate' ),
            'footer' => __( 'Footer Menu', 'versatile-corporate' )
        ));

        register_sidebar( array(
            'name' => 'Footer Widget 1',
            'id' => 'footer-sidebar-1',
            'description' => __( 'Appears in the footer area', 'versatile-corporate' ),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget' => '</aside>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        register_sidebar( array(
            'name' => 'Footer Widget 2',
            'id' => 'footer-sidebar-2',
            'description' => __( 'Appears in the footer area', 'versatile-corporate' ),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget' => '</aside>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));

        add_editor_style('/assets/css/editor-style');

        add_theme_support( 'post-thumbnails' );
        add_theme_support( 'automatic-feed-links' );
        add_theme_support( 'title-tag' );
        add_theme_support(
            'html5',
            array (
                'comment-form',
                'comment-list',
                'gallery',
                'caption',
            )
        );

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

        add_theme_support(
            'custom-logo',
            array(
                'height'      => 100,
                'width'       => 350,
                'flex-height' => true,
                'flex-width'  => true,
            )
        );

        add_theme_support( "responsive-embeds" );
        add_theme_support( 'align-wide' );
        add_theme_support( 'wp-block-styles' );
    }

    add_filter('excerpt_more','__return_false');
}
add_action( 'after_setup_theme', 'versatile_corporate_setup' );

remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );

if ( ! function_exists( 'versatile_corporate_widgets_init' ) ) {
    
    function versatile_corporate_widgets_init() {
        register_sidebar( array (
            'name' => __( 'Main Sidebar', 'versatile-corporate' ),
            'id' => 'sidebar-1',
            'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'versatile-corporate' ),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget' => '</aside>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',
        ));
    }
}
add_action( 'widgets_init', 'versatile_corporate_widgets_init' );

if ( ! function_exists( 'versatile_corporate_scripts_styles' ) ) {

    function versatile_corporate_scripts_styles() {

        wp_enqueue_style(
            'versatile-coporate-main',
            get_template_directory_uri() . '/style.css',
            [],
            VERSATILE_CORPORATE_VERSION
        );

        wp_enqueue_style(
            'versatile-coporate-theme-style',
            get_template_directory_uri() . '/theme.min.css',
            [],
            VERSATILE_CORPORATE_VERSION
        );

        wp_enqueue_style(
            'versatile-coporate-font-awesome',
            get_template_directory_uri() . '/assets/css/font-awesome.css',
            [],
            VERSATILE_CORPORATE_VERSION
        );

        wp_enqueue_script( 
            'versatile-coporate-custom-script', 
            get_stylesheet_directory_uri() . '/assets/js/versatile_corporate_script.js', 
            array( 'jquery' ), 
            VERSATILE_CORPORATE_VERSION
        );

    }
}
add_action( 'wp_enqueue_scripts', 'versatile_corporate_scripts_styles' );


require get_template_directory() . '/includes/versatile-corporate-theme-options.php';
require get_template_directory() . '/includes/tgmpa/tgmpa-configuration.php';
require get_template_directory() . '/includes/class-versatile-corporate-walker-page.php';