<?php

/**
 * @package Opening Shortly Lite
 */

require_once get_template_directory() . "/customfunctions.php";
require_once get_template_directory() . "/core/opening-shortly-lite-customization.php";
require_once get_template_directory() . "/lib/opening-shortly-lite-page-functions.php";

function opening_shortly_lite_customize_controls_js() {
    $theme = wp_get_theme();
    wp_enqueue_style('opening-shortly-lite-customizer-section-pro', get_template_directory_uri() . '/core/customize-controls.css', $theme->get('Version'));
    wp_enqueue_script('opening-shortly-lite-customizer-section-pro-jquery', get_template_directory_uri() . '/core/customize-controls.js', array('customize-controls'), $theme->get('Version'), true);
}
add_action('customize_controls_enqueue_scripts', 'opening_shortly_lite_customize_controls_js');



function opening_shortly_lite_widgets_init() {

    register_sidebar(array(
        'name'          => esc_html__('Sidebar', 'opening-shortly-lite'),
        'description'   => esc_html__('Appears on sidebar', 'opening-shortly-lite'),
        'id'            => 'sidebar-1',
        'before_widget' => '',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3><aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
    ));
}

add_action('widgets_init', 'opening_shortly_lite_widgets_init');

function opening_shortly_lite_register_block_extras() {
    if (function_exists('register_block_style')) {
        register_block_style('core/button', array(
            'name'  => 'opening-cta',
            'label' => esc_html__('Opening CTA', 'opening-shortly-lite'),
        ));
    }
    if (function_exists('register_block_pattern')) {
        register_block_pattern('opening-shortly-lite/cta', array(
            'title'   => esc_html__('Call to action', 'opening-shortly-lite'),
            'content' => '<!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button --><div class="wp-block-button"><a class="wp-block-button__link">Notify Me</a></div><!-- /wp:button --></div><!-- /wp:buttons -->',
        ));
    }
}
add_action('init', 'opening_shortly_lite_register_block_extras');