Skip to content

Commit

Permalink
Merge pull request #449 from bootscore/Add-new-header-widget
Browse files Browse the repository at this point in the history
Add 2 more widget areas and improve existing ones
  • Loading branch information
justinkruit committed Apr 15, 2023
2 parents 3cd00f6 + a7fb1ec commit 3a49fd6
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 93 deletions.
29 changes: 10 additions & 19 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,38 @@

<!-- Top Footer Widget -->
<?php if (is_active_sidebar('top-footer')) : ?>
<div>
<?php dynamic_sidebar('top footer'); ?>
</div>
<?php dynamic_sidebar('top footer'); ?>
<?php endif; ?>

<div class="row">

<!-- Footer 1 Widget -->
<div class="col-md-6 col-lg-3">
<?php if (is_active_sidebar('footer-1')) : ?>
<div>
<?php dynamic_sidebar('footer-1'); ?>
</div>
<?php dynamic_sidebar('footer-1'); ?>
<?php endif; ?>
</div>

<!-- Footer 2 Widget -->
<div class="col-md-6 col-lg-3">
<?php if (is_active_sidebar('footer-2')) : ?>
<div>
<?php dynamic_sidebar('footer-2'); ?>
</div>
<?php dynamic_sidebar('footer-2'); ?>
<?php endif; ?>
</div>

<!-- Footer 3 Widget -->
<div class="col-md-6 col-lg-3">
<?php if (is_active_sidebar('footer-3')) : ?>
<div>
<?php dynamic_sidebar('footer-3'); ?>
</div>
<?php dynamic_sidebar('footer-3'); ?>
<?php endif; ?>
</div>

<!-- Footer 4 Widget -->
<div class="col-md-6 col-lg-3">
<?php if (is_active_sidebar('footer-4')) : ?>
<div>
<?php dynamic_sidebar('footer-4'); ?>
</div>
<?php dynamic_sidebar('footer-4'); ?>
<?php endif; ?>
</div>
<!-- Footer Widgets End -->

</div>

Expand All @@ -79,14 +68,16 @@
'walker' => new bootstrap_5_wp_nav_menu_walker()
));
?>
<!-- Bootstrap 5 Nav Walker Footer Menu End -->

</div>
</div>

<div class="bootscore-info bg-light text-muted border-top py-2 text-center">
<div class="bootscore-info bg-light text-secondary border-top py-2 text-center">
<div class="<?php echo bootscore_container_class(); ?>">
<small>&copy;&nbsp;<?php echo Date('Y'); ?> - <?php bloginfo('name'); ?></small>
<?php if (is_active_sidebar('footer-info')) : ?>
<?php dynamic_sidebar('footer-info'); ?>
<?php endif; ?>
<small class="bootscore-copyright">&copy;&nbsp;<?php echo Date('Y'); ?> - <?php bloginfo('name'); ?></small>
</div>
</div>

Expand Down
49 changes: 31 additions & 18 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,23 @@ function bootscore_widgets_init() {
'name' => esc_html__('Top Nav', 'bootscore'),
'id' => 'top-nav',
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="ms-3">',
'before_widget' => '<div class="top-nav-widget ms-2">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title d-none">',
'after_title' => '</div>'
));
// Top Nav End

// Top Nav 2
// Adds a widget next to the Top Nav position but moves to offcanvas on <lg breakpoint
register_sidebar(array(
'name' => esc_html__('Top Nav 2', 'bootscore'),
'id' => 'top-nav-2',
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="top-nav-widget-2 d-lg-flex align-items-lg-center mt-2 mt-lg-0 ms-lg-2">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title d-none">',
'after_title' => '</div>'
));

// Top Nav Search
register_sidebar(array(
Expand All @@ -141,19 +152,17 @@ function bootscore_widgets_init() {
'before_title' => '<div class="widget-title d-none">',
'after_title' => '</div>'
));
// Top Nav Search End

// Sidebar
register_sidebar(array(
'name' => esc_html__('Sidebar', 'bootscore'),
'id' => 'sidebar-1',
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<section id="%1$s" class="widget %2$s card mb-4">',
'after_widget' => '<div></section>',
'before_widget' => '<section id="%1$s" class="widget %2$s card card-body mb-4">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title card-header h5">',
'after_title' => '</h2><div class="card-body">',
'after_title' => '</h2>',
));
// Sidebar End

// Top Footer
register_sidebar(array(
Expand All @@ -165,7 +174,6 @@ function bootscore_widgets_init() {
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>'
));
// Top Footer End

// Footer 1
register_sidebar(array(
Expand All @@ -174,10 +182,9 @@ function bootscore_widgets_init() {
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="footer_widget mb-4">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title h4">',
'before_title' => '<h2 class="widget-title h5">',
'after_title' => '</h2>'
));
// Footer 1 End

// Footer 2
register_sidebar(array(
Expand All @@ -186,10 +193,9 @@ function bootscore_widgets_init() {
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="footer_widget mb-4">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title h4">',
'before_title' => '<h2 class="widget-title h5">',
'after_title' => '</h2>'
));
// Footer 2 End

// Footer 3
register_sidebar(array(
Expand All @@ -198,10 +204,9 @@ function bootscore_widgets_init() {
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="footer_widget mb-4">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title h4">',
'before_title' => '<h2 class="widget-title h5">',
'after_title' => '</h2>'
));
// Footer 3 End

// Footer 4
register_sidebar(array(
Expand All @@ -210,10 +215,20 @@ function bootscore_widgets_init() {
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="footer_widget mb-4">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widget-title h4">',
'before_title' => '<h2 class="widget-title h5">',
'after_title' => '</h2>'
));
// Footer 4 End

// Footer Info
register_sidebar(array(
'name' => esc_html__('Footer Info', 'bootscore'),
'id' => 'footer-info',
'description' => esc_html__('Add widgets here.', 'bootscore'),
'before_widget' => '<div class="footer_widget">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title d-none">',
'after_title' => '</div>'
));

// 404 Page
register_sidebar(array(
Expand All @@ -225,12 +240,10 @@ function bootscore_widgets_init() {
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>'
));
// 404 Page End

}
add_action('widgets_init', 'bootscore_widgets_init');


endif;
// Widgets END

Expand Down
54 changes: 28 additions & 26 deletions header-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@

<!-- Offcanvas Navbar -->
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvas-navbar">
<div class="offcanvas-header bg-light">
<span class="h5 mb-0"><?php esc_html_e('Menu', 'bootscore'); ?></span>
<div class="offcanvas-header">
<span class="h5 offcanvas-title"><?php esc_html_e('Menu', 'bootscore'); ?></span>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">

<!-- Bootstrap 5 Nav Walker Main Menu -->
<?php
wp_nav_menu(array(
Expand All @@ -68,25 +69,28 @@
'walker' => new bootstrap_5_wp_nav_menu_walker()
));
?>
<!-- Bootstrap 5 Nav Walker Main Menu End -->

<!-- Top Nav 2 Widget -->
<?php if (is_active_sidebar('top-nav-2')) : ?>
<?php dynamic_sidebar('top-nav-2'); ?>
<?php endif; ?>

</div>
</div>

<div class="header-actions d-flex align-items-center">

<!-- Top Nav Widget -->
<div class="top-nav-widget">
<?php if (is_active_sidebar('top-nav')) : ?>
<div>
<?php dynamic_sidebar('top-nav'); ?>
</div>
<?php endif; ?>
</div>
<?php if (is_active_sidebar('top-nav')) : ?>
<?php dynamic_sidebar('top-nav'); ?>
<?php endif; ?>

<!-- Search Toggler -->
<button class="btn btn-outline-secondary ms-1 ms-md-2 top-nav-search-md" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-search" aria-expanded="false" aria-controls="collapse-search">
<i class="fa-solid fa-magnifying-glass"></i><span class="visually-hidden-focusable">Search</span>
</button>
<?php if (is_active_sidebar('top-nav-search')) : ?>
<button class="btn btn-outline-secondary ms-1 ms-md-2 top-nav-search-md" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-search" aria-expanded="false" aria-controls="collapse-search">
<i class="fa-solid fa-magnifying-glass"></i><span class="visually-hidden-focusable">Search</span>
</button>
<?php endif; ?>

<!-- User Toggler -->
<button class="btn btn-outline-secondary ms-1 ms-md-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-user" aria-controls="offcanvas-user">
Expand Down Expand Up @@ -115,25 +119,23 @@

</div><!-- .header-actions -->

</div><!-- .<?php echo bootscore_container_class(); ?> -->
</div><!-- bootscore_container_class(); -->

</nav><!-- .navbar -->

<!-- Top Nav Search Collapse -->
<div class="collapse <?php echo bootscore_container_class(); ?>" id="collapse-search">
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div class="mb-2">
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>
</div>
<!-- Top Nav Search Collapse -->
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div class="collapse <?php echo bootscore_container_class(); ?> mb-2" id="collapse-search">
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>

</div><!-- .fixed-top .bg-light -->

<!-- offcanvas user -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvas-user">
<div class="offcanvas-header bg-light">
<span class="h5 mb-0"><?php esc_html_e('Account', 'bootscore'); ?></span>
<div class="offcanvas-header">
<span class="h5 offcanvas-title"><?php esc_html_e('Account', 'bootscore'); ?></span>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
Expand All @@ -145,8 +147,8 @@

<!-- offcanvas cart -->
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvas-cart">
<div class="offcanvas-header bg-light">
<span class="h5 mb-0"><?php esc_html_e('Cart', 'bootscore'); ?></span>
<div class="offcanvas-header">
<span class="h5 offcanvas-title"><?php esc_html_e('Cart', 'bootscore'); ?></span>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body p-0">
Expand Down
57 changes: 28 additions & 29 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@

<!-- Offcanvas Navbar -->
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvas-navbar">
<div class="offcanvas-header bg-light">
<span class="h5 mb-0"><?php esc_html_e('Menu', 'bootscore'); ?></span>
<div class="offcanvas-header">
<span class="h5 offcanvas-title"><?php esc_html_e('Menu', 'bootscore'); ?></span>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">

<!-- Bootstrap 5 Nav Walker Main Menu -->
<?php
wp_nav_menu(array(
Expand All @@ -68,35 +69,35 @@
'walker' => new bootstrap_5_wp_nav_menu_walker()
));
?>
<!-- Bootstrap 5 Nav Walker Main Menu End -->

<!-- Top Nav 2 Widget -->
<?php if (is_active_sidebar('top-nav-2')) : ?>
<?php dynamic_sidebar('top-nav-2'); ?>
<?php endif; ?>

</div>
</div>


<div class="header-actions d-flex align-items-center">

<!-- Top Nav Widget -->
<div class="top-nav-widget">
<?php if (is_active_sidebar('top-nav')) : ?>
<div>
<?php dynamic_sidebar('top-nav'); ?>
</div>
<?php endif; ?>
</div>
<?php if (is_active_sidebar('top-nav')) : ?>
<?php dynamic_sidebar('top-nav'); ?>
<?php endif; ?>

<!-- Searchform Large -->
<div class="d-none d-lg-block ms-1 ms-md-2 top-nav-search-lg">
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div>
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>
</div>
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div class="d-none d-lg-block ms-1 ms-md-2 top-nav-search-lg">
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>

<!-- Search Toggler Mobile -->
<button class="btn btn-outline-secondary d-lg-none ms-1 ms-md-2 top-nav-search-md" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-search" aria-expanded="false" aria-controls="collapse-search">
<i class="fa-solid fa-magnifying-glass"></i><span class="visually-hidden-focusable">Search</span>
</button>
<?php if (is_active_sidebar('top-nav-search')) : ?>
<button class="btn btn-outline-secondary d-lg-none ms-1 ms-md-2 top-nav-search-md" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-search" aria-expanded="false" aria-controls="collapse-search">
<i class="fa-solid fa-magnifying-glass"></i><span class="visually-hidden-focusable">Search</span>
</button>
<?php endif; ?>

<!-- Navbar Toggler -->
<button class="btn btn-outline-secondary d-lg-none ms-1 ms-md-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-navbar" aria-controls="offcanvas-navbar">
Expand All @@ -105,18 +106,16 @@

</div><!-- .header-actions -->

</div><!-- .<?php echo bootscore_container_class(); ?> -->
</div><!-- bootscore_container_class(); -->

</nav><!-- .navbar -->

<!-- Top Nav Search Mobile Collapse -->
<div class="collapse <?php echo bootscore_container_class(); ?> d-lg-none" id="collapse-search">
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div class="mb-2">
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>
</div>
<?php if (is_active_sidebar('top-nav-search')) : ?>
<div class="collapse <?php echo bootscore_container_class(); ?> d-lg-none mb-2" id="collapse-search">
<?php dynamic_sidebar('top-nav-search'); ?>
</div>
<?php endif; ?>

</div><!-- .fixed-top .bg-light -->

Expand Down
Loading

0 comments on commit 3a49fd6

Please sign in to comment.