<?php

if (!defined('ABSPATH')) {
    exit;
}

/*----------------------------------------
メールフォーム：公開画面用CSS読み込み
----------------------------------------*/
function immf_enqueue_contact_form_frontend_assets() {

    $style_path = IMMF_PATH
        . 'assets/css/frontend/form.css';

    wp_enqueue_style(
        'im-mail-form',
        IMMF_URL
            . 'assets/css/frontend/form.css',
        [],
        file_exists($style_path)
            ? filemtime($style_path)
            : IMMF_VERSION
    );

    $script_path = IMMF_PATH
        . 'assets/js/frontend/form.js';

    wp_enqueue_script(
        'im-mail-form',
        IMMF_URL
            . 'assets/js/frontend/form.js',
        [],
        file_exists($script_path)
            ? filemtime($script_path)
            : IMMF_VERSION,
        true
    );
}

add_action(
    'wp_enqueue_scripts',
    'immf_enqueue_contact_form_frontend_assets'
);