<?php
/*
 * Disallow direct access
 */
if (!defined('ABSPATH')) {
    die('Forbidden.');
}
function fota_speakers_scripts()
{
    // enqueue parent style
    wp_enqueue_style('fota-speakers-parent-style', get_template_directory_uri() . '/style.css');
    wp_enqueue_script('fota-speakers-scripts', get_stylesheet_directory_uri() . '/assets/js/fota-speakers-scripts.js', array(), '', true);
}
add_action('wp_enqueue_scripts', 'fota_speakers_scripts');

if (!function_exists('fota_speakers_excerpt_limit')) {
    function fota_speakers_excerpt_limit($length)
    {
        if (is_admin()) {
            return $length;
        }
        return 40;
    }
    add_filter('excerpt_length', 'fota_speakers_excerpt_limit');
}

/**
 * Registers pattern categories.
 *
 * @since fota-home-solutions 1.0.0
 *
 * @return void
 */
function fota_speakers_register_pattern_category()
{

    $patterns = array();

    $block_pattern_categories = array(
        'fota-speakers' => array('label' => __('Fota Speakers Patterns', 'fota-speakers'))
    );

    $block_pattern_categories = apply_filters('fota_speakers_block_pattern_categories', $block_pattern_categories);

    foreach ($block_pattern_categories as $name => $properties) {
        if (!WP_Block_Pattern_Categories_Registry::get_instance()->is_registered($name)) {
            register_block_pattern_category($name, $properties);
        }
    }
}
add_action('init', 'fota_speakers_register_pattern_category', 9);
