Files
bit-wms-site/wp-content/themes/bitwms-child/functions.php
T
admin b47ad7bef4 feat: add fixed sidebar navigation with hover expand and mobile hamburger
Implements Task 3: fixed left sidebar (70px collapsed → 250px on hover) with
9 nav items, social links, active-state detection, and mobile hamburger toggle
that matches the existing sidebar-nav.js selectors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 01:03:57 +05:00

63 lines
1.8 KiB
PHP

<?php
/**
* БИТ.WMS Child Theme — functions.php
*
* Bootstraps the child theme: enqueues parent GeneratePress styles,
* enqueues the child theme stylesheet, and loads include files.
*
* @package bitwms-child
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Prevent direct access.
}
// ---------------------------------------------------------------------------
// 1. Enqueue parent + child styles
// ---------------------------------------------------------------------------
add_action( 'wp_enqueue_scripts', 'bitwms_child_enqueue_styles' );
function bitwms_child_enqueue_styles() {
// Parent GeneratePress stylesheet.
wp_enqueue_style(
'generatepress-style',
get_template_directory_uri() . '/style.css',
array(),
wp_get_theme( 'generatepress' )->get( 'Version' )
);
// Child theme stylesheet — depends on parent.
wp_enqueue_style(
'bitwms-child-style',
get_stylesheet_uri(),
array( 'generatepress-style' ),
wp_get_theme()->get( 'Version' )
);
}
// ---------------------------------------------------------------------------
// 2. Load include files
// ---------------------------------------------------------------------------
$bitwms_includes = array(
'inc/enqueue.php',
);
foreach ( $bitwms_includes as $bitwms_file ) {
$bitwms_path = get_stylesheet_directory() . '/' . $bitwms_file;
if ( file_exists( $bitwms_path ) ) {
require_once $bitwms_path;
}
}
unset( $bitwms_file, $bitwms_path );
// ---------------------------------------------------------------------------
// 3. Inject sidebar navigation before the GeneratePress header
// ---------------------------------------------------------------------------
add_action( 'generate_before_header', function () {
get_template_part( 'templates/sidebar-nav' );
} );