<?php
/*
 * Disallow direct access
 */
if (!defined('ABSPATH')) {
    die('Forbidden.');
}
function fota_home_solutions_scripts()
{
    // enqueue parent style
    wp_enqueue_style('fota-home-solutions-parent-style', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'fota_home_solutions_scripts');

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

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

    $patterns = array();

    $block_pattern_categories = array(
        'fhs-patterns' => array('label' => __('FHS Patterns', 'fota-home-solutions'))
    );

    $block_pattern_categories = apply_filters('fota_home_solutions_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_home_solutions_register_pattern_category', 9);
