Files
bit-wms-site/wp-content/themes/bitwms-child/inc/enqueue.php
T

49 lines
1.2 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
);
// 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' ),
)
);
}
}