Skip to content

Commit

Permalink
Make bootscore_main_col_class a filter
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkruit committed Sep 15, 2023
1 parent e903f0d commit 94239fc
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 12 deletions.
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="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col') ?>">

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

Expand Down
22 changes: 20 additions & 2 deletions inc/columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/**
* Columns
*
* @package Bootscore
* @package Bootscore
* @version 5.3.3
*/


// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
defined('ABSPATH') || exit;


/**
Expand All @@ -28,6 +28,24 @@ function bootscore_main_col_class() {
}
}

/**
* Determines the CSS class for the main column based on the presence of a sidebar.
*
* @param string $string The default CSS class for the main column.
*
* @return string The CSS class for the main column. If a sidebar is active, it will return "col-md-8 col-lg-9". Otherwise, it will return the provided $string.
*/
function bootscore_main_col_class_sidebar($string) {
if (is_active_sidebar('sidebar-1')) {
// Sidebar is not empty
return "col-md-8 col-lg-9";
}

return $string;
}

add_filter('bootscore_main_col_class', 'bootscore_main_col_class_sidebar');


/**
* Sidebar column width and breakpoints
Expand Down
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="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">
<!-- Grid Layout -->
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Expand Down
2 changes: 1 addition & 1 deletion page-templates/page-full-width-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<?php bs_after_primary(); ?>

<div class="row">
<div class="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">

<div class="entry-content">
<?php the_content(); ?>
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="<?= bootscore_main_col_class(); ?> order-first order-md-last">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?> 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="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">

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

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="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">

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

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

<div class="row">
<div class="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">

<div class="entry-content">
<?php bootscore_category_badge(); ?>
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 @@ -19,7 +19,7 @@

<div class="row">
<?php get_sidebar(); ?>
<div class="<?= bootscore_main_col_class(); ?> order-first order-md-last">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?> 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 @@ -17,7 +17,7 @@
<?php the_breadcrumb(); ?>

<div class="row">
<div class="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">

<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="<?= bootscore_main_col_class(); ?>">
<div class="<?= apply_filters('bootscore_main_col_class', 'col'); ?>">
<?php woocommerce_content(); ?>
</div>
<!-- sidebar -->
Expand Down

0 comments on commit 94239fc

Please sign in to comment.