180 lines
8.5 KiB
PHP
180 lines
8.5 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',
|
||
'inc/cpt.php',
|
||
'inc/acf-fields.php',
|
||
'inc/ajax-filter.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' );
|
||
} );
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// 4. Inject top header bar (priority 20 — after sidebar at default/10)
|
||
// ---------------------------------------------------------------------------
|
||
|
||
add_action( 'generate_before_header', function () {
|
||
get_template_part( 'templates/top-header' );
|
||
}, 20 );
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// 5. Custom footer (before GeneratePress footer, priority 5)
|
||
// ---------------------------------------------------------------------------
|
||
|
||
add_action( 'generate_before_footer_content', function () {
|
||
$theme_uri = get_stylesheet_directory_uri();
|
||
$current_year = gmdate( 'Y' );
|
||
?>
|
||
<div class="custom-footer">
|
||
<div class="container">
|
||
<div class="custom-footer__grid">
|
||
|
||
<!-- Col 1: Logo + contacts -->
|
||
<div class="custom-footer__col custom-footer__col--brand">
|
||
<a href="/" class="custom-footer__logo-link" aria-label="<?php esc_attr_e( 'БИТ.WMS — на главную', 'bitwms-child' ); ?>">
|
||
<img
|
||
src="<?php echo esc_url( $theme_uri . '/img/logo.svg' ); ?>"
|
||
alt="<?php esc_attr_e( 'БИТ.WMS', 'bitwms-child' ); ?>"
|
||
width="140"
|
||
height="40"
|
||
class="custom-footer__logo"
|
||
loading="lazy"
|
||
>
|
||
</a>
|
||
<address class="custom-footer__address">
|
||
<p><?php esc_html_e( 'г. Екатеринбург, ул. Хохрякова, 10, оф. 405', 'bitwms-child' ); ?></p>
|
||
<p>
|
||
<a href="<?php echo esc_url( 'tel:+73432000000' ); ?>">
|
||
<?php esc_html_e( '+7 (343) 200-00-00', 'bitwms-child' ); ?>
|
||
</a>
|
||
</p>
|
||
<p>
|
||
<a href="<?php echo esc_url( 'mailto:wms@1bit.ru' ); ?>">
|
||
<?php esc_html_e( 'wms@1bit.ru', 'bitwms-child' ); ?>
|
||
</a>
|
||
</p>
|
||
</address>
|
||
</div>
|
||
|
||
<!-- Col 2: Разделы -->
|
||
<div class="custom-footer__col custom-footer__col--sections">
|
||
<h4><?php esc_html_e( 'Разделы', 'bitwms-child' ); ?></h4>
|
||
<ul>
|
||
<li><a href="<?php echo esc_url( '/cases/' ); ?>"><?php esc_html_e( 'Кейсы', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/articles/' ); ?>"><?php esc_html_e( 'Статьи', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/webinars/' ); ?>"><?php esc_html_e( 'Вебинары', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/courses/' ); ?>"><?php esc_html_e( 'Курсы', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/events/' ); ?>"><?php esc_html_e( 'Мероприятия', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/materials/' ); ?>"><?php esc_html_e( 'Материалы', 'bitwms-child' ); ?></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- Col 3: Продукты -->
|
||
<div class="custom-footer__col custom-footer__col--products">
|
||
<h4><?php esc_html_e( 'Продукты', 'bitwms-child' ); ?></h4>
|
||
<ul>
|
||
<li><a href="<?php echo esc_url( '/bitwms/' ); ?>"><?php esc_html_e( 'БИТ.WMS', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/1c-wms/' ); ?>"><?php esc_html_e( '1C:WMS', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/cleverence/' ); ?>"><?php esc_html_e( 'Клеверенс', 'bitwms-child' ); ?></a></li>
|
||
<li><a href="<?php echo esc_url( '/1c-tms/' ); ?>"><?php esc_html_e( '1C:TMS', 'bitwms-child' ); ?></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- Col 4: Подписка -->
|
||
<div class="custom-footer__col custom-footer__col--subscribe">
|
||
<h4><?php esc_html_e( 'Подписка', 'bitwms-child' ); ?></h4>
|
||
<p class="custom-footer__subscribe-desc">
|
||
<?php esc_html_e( 'Получайте новые материалы на email', 'bitwms-child' ); ?>
|
||
</p>
|
||
<form class="footer-subscribe" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" novalidate>
|
||
<?php wp_nonce_field( 'bitwms_footer_subscribe', 'bitwms_subscribe_nonce' ); ?>
|
||
<input type="hidden" name="action" value="bitwms_footer_subscribe">
|
||
<input
|
||
type="email"
|
||
name="subscribe_email"
|
||
class="footer-subscribe__input"
|
||
placeholder="<?php esc_attr_e( 'ваш@email.ru', 'bitwms-child' ); ?>"
|
||
required
|
||
autocomplete="email"
|
||
aria-label="<?php esc_attr_e( 'Email для подписки', 'bitwms-child' ); ?>"
|
||
>
|
||
<button type="submit" class="btn btn--primary btn--sm footer-subscribe__btn">
|
||
<?php esc_html_e( 'OK', 'bitwms-child' ); ?>
|
||
</button>
|
||
</form>
|
||
</div>
|
||
|
||
</div><!-- .custom-footer__grid -->
|
||
|
||
<div class="custom-footer__bottom">
|
||
<p>© <?php echo esc_html( $current_year ); ?> <?php esc_html_e( 'Первый Бит. Все права защищены.', 'bitwms-child' ); ?></p>
|
||
<div class="custom-footer__legal">
|
||
<a href="<?php echo esc_url( '/privacy-policy/' ); ?>">
|
||
<?php esc_html_e( 'Политика конфиденциальности', 'bitwms-child' ); ?>
|
||
</a>
|
||
<a href="<?php echo esc_url( '/consent/' ); ?>">
|
||
<?php esc_html_e( 'Согласие на обработку данных', 'bitwms-child' ); ?>
|
||
</a>
|
||
</div>
|
||
</div><!-- .custom-footer__bottom -->
|
||
|
||
</div><!-- .container -->
|
||
</div><!-- .custom-footer -->
|
||
<?php
|
||
}, 5 );
|