CSS and JS Video Tutorial in Administration

Sometimes the functions that you want to set up in the administration require the use of JavaScript or CSS. It will then be possible to use the hook admin_enqueue_scripts to save the assets to load. The operation is identical to that of the hook inquiry_script but we will try to make sure not to load heavy files on the whole administration if it is only necessary for our option panel.

function montheme_admin_scripts ($ suffix) {
    if ($ suffix === 'settings_page_agence_options') {
        wp_register_style ('flatpickr', 'https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css', (), false);
        wp_register_script ('flatpickr', 'https://cdn.jsdelivr.net/npm/flatpickr', (), false, true);
        wp_enqueue_script ('montheme_admin', get_template_directory_uri (). '/assets/admin.js', ('flatpickr'), false, true);
        wp_enqueue_style ('flatpickr');
add_action ('admin_enqueue_scripts', 'montheme_admin_scripts'));