Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make main col width dynamic #458

Merged
merged 6 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<?php bs_after_primary(); ?>

<div class="row">
<div class="col">
<div class="<?php echo bootscore_main_col_class(); ?>">

<main id="main" class="site-main">

Expand Down
24 changes: 21 additions & 3 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function bootscore_body_classes($classes) {
}
add_filter('body_class', 'bootscore_body_classes');


/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
Expand All @@ -43,7 +44,24 @@ function bootscore_pingback_header() {
* @return string
*/
if ( !function_exists( 'bootscore_container_class' ) ) {
function bootscore_container_class() {
return "container";
}
function bootscore_container_class() {
return "container";
}
}


/**
* Make main content col dynamic if sidebar widgets exists
* @return string
*/
if ( !function_exists( 'bootscore_main_col_class' ) ) {
function bootscore_main_col_class() {
if (!is_active_sidebar('sidebar-1')) {
// Sidebar is empty
return "col";
} else {
// Sidebar has widgets
return "col-md-8 col-lg-9";
}
}
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<?php endif; ?>
<!-- Post List -->
<div class="row">
<div class="col col-md-8 col-lg-9">
<div class="<?php echo bootscore_main_col_class(); ?>">
<!-- Grid Layout -->
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Expand Down
20 changes: 13 additions & 7 deletions page-templates/page-full-width-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@
<!-- Hook to add something nice -->
<?php bs_after_primary(); ?>

<div class="entry-content">
<?php the_content(); ?>
<div class="row">
<div class="<?php echo bootscore_main_col_class(); ?>">

<div class="entry-content">
<?php the_content(); ?>
</div>

<footer class="entry-footer">
<?php comments_template(); ?>
</footer>

</div>
<?php get_sidebar(); ?>
</div>

<footer class="entry-footer">
<?php comments_template(); ?>
</footer>

</div>

</main>
Expand Down
2 changes: 1 addition & 1 deletion page-templates/page-sidebar-left.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div class="row">
<?php get_sidebar(); ?>
<div class="col-md-8 col-lg-9 order-first order-md-last">
<div class="<?php echo bootscore_main_col_class(); ?> order-first order-md-last">

<main id="main" class="site-main">

Expand Down
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<?php bs_after_primary(); ?>

<div class="row">
<div class="col-md-8 col-lg-9">
<div class="<?php echo bootscore_main_col_class(); ?>">

<main id="main" class="site-main">

Expand Down
1 change: 1 addition & 0 deletions scss/bootscore/_admin_bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Admin bar
// Push content down when WP admin-bar is visible
.fixed-top,
.offcanvas:not(.offcanvas-bottom),
.offcanvas-md,
.offcanvas-lg,
.offcanvas-xl,
.offcanvas-xxl,
Expand Down
2 changes: 1 addition & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<?php bs_after_primary(); ?>

<div class="row">
<div class="col">
<div class="<?php echo bootscore_main_col_class(); ?>">

<main id="main" class="site-main">

Expand Down
63 changes: 35 additions & 28 deletions single-templates/single-full-width-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,44 @@
<?php bs_after_primary(); ?>

<?php the_breadcrumb(); ?>

<div class="row">
<div class="<?php echo bootscore_main_col_class(); ?>">

<div class="entry-content">
<?php bootscore_category_badge(); ?>
<p class="entry-meta">
<small class="text-muted">
<?php
bootscore_date();
bootscore_author();
bootscore_comment_count();
?>
</small>
</p>
<?php the_content(); ?>
</div>
<div class="entry-content">
<?php bootscore_category_badge(); ?>
<p class="entry-meta">
<small class="text-muted">
<?php
bootscore_date();
bootscore_author();
bootscore_comment_count();
?>
</small>
</p>
<?php the_content(); ?>
</div>

<footer class="entry-footer clear-both">
<div class="mb-4">
<?php bootscore_tags(); ?>
<footer class="entry-footer clear-both">
<div class="mb-4">
<?php bootscore_tags(); ?>
</div>
<nav aria-label="bS page navigation">
<ul class="pagination justify-content-center">
<li class="page-item">
<?php previous_post_link('%link'); ?>
</li>
<li class="page-item">
<?php next_post_link('%link'); ?>
</li>
</ul>
</nav>
<?php comments_template(); ?>
</footer>

</div>
<nav aria-label="bS page navigation">
<ul class="pagination justify-content-center">
<li class="page-item">
<?php previous_post_link('%link'); ?>
</li>
<li class="page-item">
<?php next_post_link('%link'); ?>
</li>
</ul>
</nav>
<?php comments_template(); ?>
</footer>
<?php get_sidebar(); ?>
</div>

</div>

Expand Down
2 changes: 1 addition & 1 deletion single-templates/single-sidebar-left.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<div class="row">
<?php get_sidebar(); ?>
<div class="col-md-8 col-lg-9 order-first order-md-last">
<div class="<?php echo bootscore_main_col_class(); ?> order-first order-md-last">

<main id="main" class="site-main">

Expand Down
2 changes: 1 addition & 1 deletion single.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<?php the_breadcrumb(); ?>

<div class="row">
<div class="col-md-8 col-lg-9">
<div class="<?php echo bootscore_main_col_class(); ?>">

<main id="main" class="site-main">

Expand Down
2 changes: 1 addition & 1 deletion woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!-- Breadcrumb -->
<?php woocommerce_breadcrumb(); ?>
<div class="row">
<div class="col">
<div class="<?php echo bootscore_main_col_class(); ?>">
<?php woocommerce_content(); ?>
</div>
<!-- sidebar -->
Expand Down