52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* БИТ.WMS Child Theme — inc/enqueue.php
|
|
*
|
|
* Registers and enqueues theme scripts.
|
|
* Loaded by functions.php via the $bitwms_includes array.
|
|
*
|
|
* @package bitwms-child
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
add_action( 'wp_enqueue_scripts', 'bitwms_enqueue_scripts', 20 );
|
|
|
|
function bitwms_enqueue_scripts() {
|
|
$theme_version = wp_get_theme()->get( 'Version' );
|
|
$theme_uri = get_stylesheet_directory_uri();
|
|
|
|
// Sidebar navigation — loaded in footer (5th arg: true).
|
|
wp_enqueue_script(
|
|
'bitwms-sidebar-nav',
|
|
$theme_uri . '/js/sidebar-nav.js',
|
|
array(), // no dependencies
|
|
$theme_version,
|
|
true // load in footer
|
|
);
|
|
|
|
// Gated content modal — loaded on all pages.
|
|
wp_enqueue_script( 'bitwms-gated-content', $theme_uri . '/js/gated-content.js', [], $theme_version, true );
|
|
|
|
// Content feed AJAX filter — front page only.
|
|
if ( is_front_page() ) {
|
|
wp_enqueue_script(
|
|
'bitwms-ajax-filter',
|
|
$theme_uri . '/js/ajax-filter.js',
|
|
array(),
|
|
$theme_version,
|
|
true
|
|
);
|
|
wp_localize_script(
|
|
'bitwms-ajax-filter',
|
|
'bitwmsAjax',
|
|
array(
|
|
'url' => admin_url( 'admin-ajax.php' ),
|
|
'nonce' => wp_create_nonce( 'bitwms_filter_nonce' ),
|
|
)
|
|
);
|
|
}
|
|
}
|