Loading...

Documentation Theme

Filters

New in v6

Enhance your theme’s versatility by effortlessly adjusting template layouts with customizable filters.

How it works

Bootscore uses filters, for example the container class:

<?= apply_filters('bootscore/class/container', 'container', 'location'); ?>

Result in frontend:

<div class="container">

Containers

To change entire containers into container-fluid, add a function to child’s functions.php:

/**
 * Change entire container classes
 */
function container_class() {
  return "container-fluid";
}
add_filter('bootscore/class/container', 'container_class', 10, 2);

Result in frontend:

<div class="container-fluid">

Container can be changed only in a single file as well, for example in header.php:

/**
 * Change container class in a single file
 */
function container_class($string, $location) {
  if ($location == 'header') {
    return "container-fluid";
  }
  return $string;
}
add_filter('bootscore/class/container', 'container_class', 10, 2);

Or select multiple files, for example header.php and footer.php:

/**
 * Change container classes in selected files
 */
function container_class($string, $location) {
  if ($location == 'header' || $location == 'footer-top' || $location == 'footer-columns' || $location == 'footer-info') {
    return "container-xxl";
  }
  return $string;
}
add_filter('bootscore/class/container', 'container_class', 10, 2);

Of course, any other container class can be used as well.

Change paths to logos

/**
 * Change path to logos
 */
function change_logo_path($logo, $color) {
  if ($color === 'theme-dark') {
    return get_stylesheet_directory_uri() . '/path/to/dark-logo.png';
  }
  return get_stylesheet_directory_uri() . '/path/to/default-logo.png';
}
add_filter('bootscore/logo', 'change_logo_path', 10, 2);

Position and bg

/**
 * Header position and bg
 */
function header_bg_class() {
  return "position-relative bg-body shadow-sm";
}
add_filter('bootscore/class/header', 'header_bg_class', 10, 2);
/**
 * Header search collapse position and bg
 */
function header_collapse_bg_class() {
  return "bg-body shadow-sm position-absolute start-0 end-0";
}
add_filter('bootscore/class/header/collapse', 'header_collapse_bg_class', 10, 2);

Breakpoints

Change navbar expand to md:

/**
 * Header navbar breakpoint
 */
function header_navbar_breakpoint_class() {
  return "navbar-expand-md";
}
add_filter('bootscore/class/header/navbar/breakpoint', 'header_navbar_breakpoint_class', 10, 2);

/**
 * Header navbar toggler breakpoint
 */
function header_navbar_toggler_breakpoint_class() {
  return "d-md-none";
}
add_filter('bootscore/class/header/navbar/toggler/breakpoint', 'header_navbar_toggler_breakpoint_class', 10, 2);

Navbar always collapsed:

/**
 * Header navbar breakpoint
 */
function header_navbar_breakpoint_class() {
  return "";
}
add_filter('bootscore/class/header/navbar/breakpoint', 'header_navbar_breakpoint_class', 10, 2);

/*
 * Header navbar toggler breakpoint
 */
function header_navbar_toggler_breakpoint_class() {
  return "";
}
add_filter('bootscore/class/header/navbar/toggler/breakpoint', 'header_navbar_toggler_breakpoint_class', 10, 2);

Buttons

Change all header button classes at once:

/**
 * Change all header buttons
 */
function header_button_class() {
  return "btn btn-light";
}
add_filter('bootscore/class/header/button', 'header_button_class', 10, 2);

Change a single button class only. For example the navbar-toggler:

/**
 * Change single header button
 */
function header_button_class($string, $location) {
  if ($location == 'nav-toggler') {
    return "btn btn-light";
  }
  return $string;
}
add_filter('bootscore/class/header/button', 'header_button_class', 10, 2);

Or select multiple buttons. For example account-toggler and mini-cart-toggler:

/**
 * Change selected header buttons
 */
function header_button_class($string, $location) {
  if ($location == 'account-toggler' || $location == 'cart-toggler') {
    return "btn btn-light";
  }
  return $string;
}
add_filter('bootscore/class/header/button', 'header_button_class', 10, 2);
/**
 * Change navbar offcanvas title
 */
function change_navbar_offcanvas_title($title) {
  return 'My Menu';
}
add_filter('bootscore/offcanvas/navbar/title', 'change_navbar_offcanvas_title');
/**
 * Footer top classes
 */
function footer_top_class() {
  return "bg-success text-white border-top border-secondary pt-5 pb-4";
}
add_filter('bootscore/class/footer/top', 'footer_top_class', 10, 2);
/**
 * Change footer column wrapper classes
 */
function footer_class() {
  return "bg-dark text-white border-top border-secondary pt-5 pb-3";
}
add_filter('bootscore/class/footer/columns', 'footer_class', 10, 2);

Change all footer columns:

/**
 * Change footer 1-4 col
 */
function footer_col_class() {
  return "col-12 col-md-6 col-lg-3";
}
add_filter('bootscore/class/footer/col', 'footer_col_class', 10, 2);

Change each footer-column:

/**
 * Change footer 1 col
 */
function footer_col_1_class($string, $location) {
  if ($location == 'footer-1') {
    return "col-6 col-md-12 col-lg-6";
  }
  return $string;
}
add_filter('bootscore/class/footer/col', 'footer_col_1_class', 10, 2);


/**
 * Change footer 2, 3, 4 col
 */
function footer_col_2_3_4_class($string, $location) {
  if ($location == 'footer-2' || $location == 'footer-3' || $location == 'footer-4') {
    return "col-6 col-md-4 col-lg-2";
  }
  return $string;
}
add_filter('bootscore/class/footer/col', 'footer_col_2_3_4_class', 10, 2);
/**
 * Change footer info classes
 */
function footer_info_class() {
  return "bg-dark text-white border-top border-secondary py-2 small";
}
add_filter('bootscore/class/footer/info', 'footer_info_class', 10, 2);

To-top button

/**
 * Change to-top button classes
 */
function footer_to_top_button_class() {
  return "btn btn-light shadow-lg";
}
add_filter('bootscore/class/footer/to_top_button', 'footer_to_top_button_class', 10, 2);

Blocks

Widget search button and icon

/**
 * Change search block button and icon
 */
function change_block_widget_search($block_content, $block) {

    $search  = array(
      'btn btn-outline-secondary ',
      '<i class="fa-solid fa-magnifying-glass"></i>'
    );
    $replace = array(
      'btn btn-primary ',
      '<i class="fa-solid fa-glasses"></i>'
    );  
  
  return str_replace($search, $replace, $block_content);
}
add_filter('bootscore/block/search/content', 'change_block_widget_search', 10, 2);

Widget categories badge

/**
 * Change widget categories badge
 */
function change_block_widget_categories_badge($block_content, $block) {
  
    $search  = array(
      '<span class="badge bg-primary-subtle text-primary-emphasis">'
    );
    $replace = array(
      '<span class="badge bg-danger rounded-pill">'
    );  

  return str_replace($search, $replace, $block_content);
}
add_filter('bootscore/block/categories/content', 'change_block_widget_categories_badge', 10, 2);

Contents

Spacer

Change entire spacers:

/**
 * Change all content spacers
 */
function change_content_spacer($spacer) {
  return 'my-5 p-5';
}
add_filter('bootscore/class/content/spacer', 'change_content_spacer');

Change spacer on an single file:

/**
 * Change content spacer on an archive page of the post type "product"
 */
function change_content_spacer($spacer) {
  if (is_post_type_archive('product')) {
    return 'my-5 p-5';
  }
  return $spacer;
}
add_filter('bootscore/class/content/spacer', 'change_content_spacer');

Hide meta post updated time

/**
 * Hide meta post updated time
 */
function disable_updated_time_display($show_updated_time) {
  return false;
}
add_filter('bootscore/meta/time/updated', 'disable_updated_time_display');

Hide meta post author

/**
 * Hide meta post author
 */
function hide_author_function($display_author) {
  return false;
}
add_filter('bootscore/meta/author', 'hide_author_function');

Main col, sidebar and breakpoints

/**
 * Change main content col
 */
function change_content_col_size($col_size) {
  if (is_active_sidebar('sidebar-1')) {
    return "col-md-9 col-lg-8 col-xl-9";
  }
  return $col_size;
}
add_filter('bootscore/class/main/col', 'change_content_col_size', 11);


/**
 * Change sidebar col
 */
function change_sidebar_col_size($col_size) {
  return "col-md-3 col-lg-4 col-xl-3 order-first order-md-2";
}
add_filter('bootscore/class/sidebar/col', 'change_sidebar_col_size');


/**
 * Change sidebar responsive offcanvas
 */
function change_sidebar_offcanvas($col_size) {
  return "offcanvas-md offcanvas-start";
}
add_filter('bootscore/class/sidebar/offcanvas', 'change_sidebar_offcanvas');


/**
 * Change sidebar toggler button breakpoint and class
 */
function change_sidebar_toggler($col_size) {
  return "d-md-none btn btn-light w-100 mb-4 d-flex justify-content-between align-items-center";
}
add_filter('bootscore/class/sidebar/button', 'change_sidebar_toggler');

Category badge

/**
 * Change category badge class
 */
function change_category_badge_link_class($class) {
  return 'badge bg-warning-subtle border border-warning-subtle text-warning-emphasis rounded-pill text-decoration-none';
}
add_filter('bootscore/class/badge/category', 'change_category_badge_link_class');

Tag badge

/**
 * Change tags badge class
 */
function change_tag_link_class($class) {
  return 'badge bg-danger-subtle border border-danger-subtle text-danger-emphasis rounded-pill text-decoration-none';
}
add_filter('bootscore/class/badge/tag', 'change_tag_link_class');

WooCommerce

Grid columns

/**
 * Change WooCommerce column class
 */
function change_woo_columns($class) {
  return 'col-6 col-lg-4';
}
add_filter('bootscore/class/woocommerce/col', 'change_woo_columns');
/**
 * Move WooCommerce content to right (Sidebar left)
 */
function move_wc_content_col_to_end($col_size) {
  if (is_woocommerce() && is_active_sidebar('sidebar-1')) {
    return "col-lg-9 order-lg-last";
  }
  return $col_size;
}
add_filter('bootscore/class/main/col', 'move_wc_content_col_to_end', 11);

Disable scripts

Font Awesome

/**
 * Disable Font Awesome
 */
add_filter('bootscore/load_fontawesome', '__return_false');

AJAX cart

/**
 * Disable AJAX cart
 */
add_filter('bootscore/load_ajax_cart', '__return_false');

scssphp compiler

/**
 * Disable scssphp compiler
 */ 
add_filter('bootscore/scss/disable_compiler', '__return_true');
To top