Contents
Filters
Filters provide a flexible way to modify project elements in the child-theme’s functions.php file without requiring a copy of a template file. This ensures an update-proof approach to customization while allowing for creative adjustments.
How it works
Many classes and other elements are wrapped in filters, enabling modifications without storing template copies in a child theme. A basic filter consists of:
- A filter name, e.g.,
bootscore/example/filter/name - A returnable value, such as a string containing one or more CSS classes
<div class="<?= esc_attr(apply_filters('bootscore/example/filter/name', 'one or more classes')); ?>">
...
</div>
Result in frontend:
<div class="one or more classes">
...
</div>
To modify these classes via a child theme, a custom function is required. This function must:
- Have a unique function name
my_fancy_filter_function - Return the modified value (in this case, CSS classes)
- Be hooked into the appropriate filter
bootscore/example/filter/name
/**
* Change one or more classes into my-custom-class
*/
function my_fancy_filter_function() {
return "my-custom-class";
}
add_filter('bootscore/example/filter/name', 'my_fancy_filter_function', 10, 2);
Result in frontend
<div class="my-custom-class">
...
</div>
Location
When a filter is used in multiple files, an additional location argument can specify where it is applied:
<?= esc_attr(apply_filters('bootscore/example/filter/name', 'one or more classes', 'location-in-which-template-this-filter-is-used')); ?>
For example, the bootscore/class/container filter is present in several template files:
In header.php:
<?= esc_attr(apply_filters('bootscore/class/container', 'container', 'header')); ?>
In archive.php:
<?= esc_attr(apply_filters('bootscore/class/container', 'container', 'archive')); ?>
Applying a basic filter without specifying a location modifies all instances:
/**
* Change entire container classes
*/
function change_entire_containers() {
return "container-fluid";
}
add_filter('bootscore/class/container', 'change_entire_containers', 10, 2);
To modify only a specific instance, the location parameter can be checked:
/**
* Change container class in a single file
*/
function change_container_in_single_file($string, $location) {
if ($location == 'header') {
return "container-fluid";
}
return $string;
}
add_filter('bootscore/class/container', 'change_container_in_single_file', 10, 2);
For multiple locations, conditions can be expanded:
/**
* Change container classes in selected files
*/
function change_container_in_selected_files($string, $location) {
if ($location == 'header' || $location == 'footer-top' || $location == 'footer-columns' || $location == 'footer-info') {
return "container-fluid";
}
return $string;
}
add_filter('bootscore/class/container', 'change_container_in_selected_files', 10, 2);
Filters reference list
Breadcrumb
bootscore/class/breadcrumb/nav
/inc/breadcrumb.phpbootscore/class/breadcrumb/ol
/inc/breadcrumb.phpbootscore/breadcrumb/divider
/inc/breadcrumb.phpbootscore/class/breadcrumb/item/link
/inc/breadcrumb.php, /woocommerce/inc/wc-breadcrumb.phpbootscore/breadcrumb/handler
/inc/breadcrumb.php, /woocommerce/inc/wc-breadcrumb.php
Drawer
bootscore/class/drawer/direction($location)
header.php, sidebar.php,/template-parts/header/drawer-woocommerce.phpbootscore/class/drawer/header($location)
header.php, sidebar.php, /template-parts/header/drawer-woocommerce.phpbootscore/class/drawer/body($location)
header.php, sidebar.php, /template-parts/header/drawer-woocommerce.phpbootscore/class/drawer/breakpoint($location)
sidebar.phpbootscore/header/navbar/drawer/title
header.phpbootscore/sidebar/drawer/class/button
sidebar.phpbootscore/sidebar/drawer/button/text
sidebar.phpbootscore/offcanvas/account/title
/template-parts/header/offcanvas-woocommerce.phpbootscore/offcanvas/cart/title
/template-parts/header/offcanvas-woocommerce.php- sidebar.php
bootscore/offcanvas/sidebar/title
Theme
bootscore/class/body
/inc/body.phpbootscore/class/header
header.phpbootscore/class/header/navbar/breakpoint
header.phpbootscore/class/container($location)
header.php, 404.php, archive.php, footer.php, index.php, page.php, search.php, single.php, woocommerce.php, /page-templates/page-blank-container.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-none.php, /page-templates/page-sidebar-left.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore/class/header/navbar-brand
header.phpbootscore/logo
header.phpbootscore/logo/width
header.phpbootscore/logo/height
header.phpbootscore/class/header-actions
header.phpbootscore/class/header/button($location)
header.php, /template-parts/header/actions-woocommerce.php, /template-parts/header/actions.phpbootscore/class/header/navbar/toggler/breakpoint
header.phpbootscore/class/header/action/spacer($location)
header.php, /template-parts/header/actions.php, /template-parts/header/actions-woocommerce.php, /inc/widgets.phpbootscore/class/header/top-nav-widget-2
/inc/widgets.phpbootscore/class/header/search/breakpoint
/template-parts/header/actions.phpbootscore/class/header/search/menu
/template-parts/header/actions.php, /template-parts/header/actions-woocommerce.phpbootscore/class/header/navbar-nav
/template-parts/header/main-menu.phpbootscore/disable/unsupported/blocks(false)
functions.phpbootscore/class/cart/product-title
/woocommerce/cart/mini-cart-item.phpbootscore/class/cart/enable_cart_product_excerpt(true)
/woocommerce/cart/mini-cart-item.phpbootscore/class/cart/product-excerpt
/woocommerce/cart/mini-cart-item.phpbootscore/class/cart/enable_cart_stock_quantity(true)
/woocommerce/cart/mini-cart-item.phpbootscore/class/header/cart/footer
/woocommerce/cart/mini-cart.phpbootscore/woocommerce/ajax-cart/update-qty/fragments/replace
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/ajax-cart/update-qty/response/before-update
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/ajax-cart/update-qty/response/after-update
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/ajax-cart/update-qty/validate-update
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/ajax-cart/update-qty/response/force-full-refresh(true)
/woocommerce/inc/ajax-cart.phpbootscore/class/woocommerce/toast-container
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/loop/out-of-stock-remove-read-more(false)
/woocommerce/inc/ajax-cart.phpbootscore/woocommerce/loop/show-out-of-stock-badge(true)
/woocommerce/inc/ajax-cart.phpbootscore/class/woocommerce/loop/out-of-stock-badge
/woocommerce/inc/ajax-cart.phpbootscore/block/product/filters/content
woocommerce/inc/blocks/wc-block-widget-product-filters.phpbootscore/class/woocommerce/loop/row
woocommerce/loop/loop-start.phpbootscore/class/woocommerce/product/card
woocommerce/content-product.php, woocommerce/content-product-cat.phpbootscore/class/woocommerce/product/card/card-body
woocommerce/content-product.php, woocommerce/content-product-cat.phpbootscore/class/reviews/tab-badge
woocommerce/inc/wc-tabs.phpbootscore/class/woocommerce/loop/add-to-cart
woocommerce/inc/wc-loop.phpbootscore/class/woocommerce/product/loop/img
woocommerce/inc/wc-loop.phpbootscore/class/woocommerce/category/loop/img
woocommerce/inc/wc-loop.phpbootscore/class/woocommerce/loop/add-to-cart/button
woocommerce/inc/wc-loop.phpbootscore/woocommerce/header/show_cart_total(true)
/woocommerce/inc/wc-mini-cart.phpbootscore/class/header/cart/badge
/woocommerce/inc/wc-mini-cart.phpbootscore/class/header/cart/total
/woocommerce/inc/wc-mini-cart.phpbootscore/class/main/col
archive.php, index.php, page.php, search.php, single.php, woocommerce.php, /inc/columns.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /single-templates/single-full-width-image.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.phpbootscore/class/entry/title($location)
404.php, archive.php, index.php, page.php, search.php, single.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore/class/entry/archive-description
archive.phpbootscore/class/content/spacer($location)
404.php, archive.php, index.php, page.php, search.php, single.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore/class/featured-full-width-img($location)
/page-templates/page-full-width-image.php, /single-templates/single-full-width-image.phpbootscore/class/full-width-img-title-wrapper($location)
/page-templates/page-full-width-image.php, /single-templates/single-full-width-image.phpbootscore/class/sidebar/col
sidebar.phpbootscore/sidebar/has_widgets
sidebar.phpbootscore/block/archives/content
/inc/blocks/block-widget-archives.phpbootscore/block/code/content
/inc/blocks/block-code.phpbootscore/block/calendar/content
/inc/blocks/block-widget-calendar.phpbootscore/block/categories/content
/inc/blocks/block-widget-categories.phpbootscore/block/latest-comments/content
/inc/blocks/block-widget-latest-comments.phpbootscore/block/latest-posts/content
/inc/blocks/block-widget-latest-posts.phpbootscore/class/widget/search/button($location)
searchform.php, /inc/blocks/block-widget-search.phpbootscore/block/search/content
/inc/blocks/block-widget-search.phpbootscore/block/table/content
/inc/blocks/block-table.phpbootscore/class/block/table
/inc/blocks/block-table.phpbootscore/icon/search
/inc/icons.phpbootscore/icon/user
/inc/icons.phpbootscore/icon/cart
/inc/icons.phpbootscore/icon/arrow-left
/inc/icons.phpbootscore/icon/bars
/inc/icons.phpbootscore/icon/home
/inc/icons.phpbootscore/icon/ellipsis-vertical
/inc/icons.phpbootscore/icon/trash
/inc/icons.phpbootscore/icon/thumbtack
i/inc/icons.phpbootscore/icon/arrow-rotate
/inc/icons.phpbootscore/icon/comments
/inc/icons.phpbootscore/icon/tag
/inc/icons.phpbootscore/icon/chevron-up
/inc/icons.phpbootscore/icon/sun
/inc/icons.phpbootscore/icon/moon
/inc/icons.phpbootscore/icon/circle-half-stroke
/inc/icons.phpbootscore/icon/bars-staggered
/inc/icons.phpbootscore/icon/circle-info
/inc/icons.phpbootscore/icon/circle-exclamation
/inc/icons.phpbootscore/icon/triangle-exclamation
/inc/icons.phpbootscore/icon/circle-check
/inc/icons.phpbootscore/class/comment/avatar
comments.php, /woocommerce/single-product/review.phpbootscore/class/comments/closed/alert
comments.phpbootscore/comments/closed/text
comments.phpbootscore/class/badge/category
/inc/template-tags.phpbootscore/meta/time/updated
/inc/template-tags.phpbootscore/meta/author
/inc/template-tags.phpbootscore/class/badge/tag
/inc/template-tags.phpbootscore/icon/tag
/inc/template-tags.phpbootscore/show/tag/icon(true)
/inc/template-tags.phpbootscore/class/single/pagination
/inc/pagination.phpbootscore/class/single/pagination/link
/inc/pagination.phpbootscore/class/footer/top
footer.phpbootscore/class/footer/columns
footer.phpbootscore/class/footer/col($location)
footer.phpbootscore/class/footer/col/spacer($location)
/inc/widgets.phpbootscore/class/footer/info
footer.phpbootscore/class/footer/to_top_button
footer.phpbootscore/skip_cart(false)
/template-parts/header/actions-woocommerce.php, /woocommerce/wc-functions.phpbootscore/load_ajax_cart(true)
/woocommerce/wc-functions.phpbootscore/wc_ajax_login(true)
/template-parts/header/offcanvas-woocommerce.php, /woocommerce/wc-functions.phpbootscore/compiler/enable_sourcemap(false)
/inc/scss-compiler.phpbootscore/compiler/main_sass
/inc/scss-compiler.php
Loop
bootscore/class/loop/card($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/card/row($location)
cards-grid.php, cards-horizontal-term.php, cards-horizontal.phpbootscore/class/loop/card/image/col($location)
cards-grid.php, cards-horizontal-term.php, cards-horizontal.phpbootscore/class/loop/card/image($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/card/content/col($location)
cards-grid.php, cards-horizontal-term.php, cards-horizontal.phpbootscore/loop/meta-wrapper($location)
cards-grid.php, cards-horizontal.php, cards-overlay.phpbootscore/class/loop/card/body($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php,bootscore/class/loop/card/content/meta-wrapper($location)
cards-grid.php, cards-horizontal.php, cards-overlay.phpbootscore/loop/category($location)
cards-grid.php, cards-horizontal.php, cards-overlay.phpbootscore/class/loop/card/content/sticky-post-badge($location)
cards-grid.php, cards-horizontal.php, cards-overlay.phpbootscore/class/loop/card/title/link($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/card/title($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/loop/meta($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/loop/excerpt($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/excerpt($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/loop/read-more($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/card-text/read-more($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/class/loop/read-more($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/loop/read-more/text($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore/loop/tags($location)
cards-grid.php, cards-horizontal.php, cards-overlay.php
Actions
While filters modify existing content, actions are used to add new elements. Actions can be used for various tasks, such as inserting a message, opening a <div> in one action and closing it in another, or adding more complex functionality.
How it works
A basic action looks like this:
<?php do_action( 'bootscore_before_masthead' ); ?>
To add content at this action hook, the following are required:
- An unique function name (e.g.,
my_fancy_action_function) - The action name (e.g.,
bootscore_before_masthead) - An
echostatement to output content
/**
* Add an alert message before the masthead.
*/
function add_alert_before_masthead() {
echo '<div class="alert alert-danger" role="alert">This is an important message!</div>';
}
add_action('bootscore_before_masthead', 'add_alert_before_masthead');
Location
When an action is used in multiple files, an additional location argument can specify where it is applied:
<?php do_action( 'bootscore_after_primary_open', 'page-sidebar-left' ); ?>
Applying a basic action without specifying a location adds content to all instances:
/**
* Add an alert message after primary open.
*/
function add_alert_after_primary_open() {
echo '<div class="alert alert-danger" role="alert">This is an important message!</div>';
}
add_action('bootscore_after_primary_open', 'add_alert_after_primary_open');
To modify only a specific instance, the location parameter can be checked:
/**
* Add an alert message after primary open for 'page-sidebar-left' location.
*/
function add_alert_after_primary_open($location) {
if ($location == 'page-sidebar-left') {
echo '<div class="alert alert-warning" role="alert">This is a warning alert for page-sidebar-left!</div>';
}
}
add_action('bootscore_after_primary_open', 'add_alert_after_primary_open');
For multiple locations, the conditions can be expanded:
/**
* Add an alert message after primary open for 'page-sidebar-left' and 'archive' location.
*/
function add_alert_after_primary_open($location) {
if ($location == 'page-sidebar-left' || $location == 'archive') {
echo '<div class="alert alert-warning" role="alert">This is a warning alert for page-sidebar-left and archive!</div>';
}
}
add_action('bootscore_after_primary_open', 'add_alert_after_primary_open');
Visual guide
The following snippet will hook an alert alert-warning to all actions to create a visual map, as shown in the screenshot in header.php. If an action has a location, it will also be displayed.

/**
* Generate hooks for all Bootscore actions
*/
$bootscore_hooks = [
'bootscore_before_masthead',
'bootscore_after_masthead_open',
'bootscore_before_navbar_brand',
'bootscore_after_navbar_brand',
'bootscore_after_nav_toggler',
'bootscore_before_masthead_close',
'bootscore_after_masthead',
'bootscore_after_primary_open',
'bootscore_before_title',
'bootscore_after_title',
'bootscore_before_single_pagination',
'bootscore_before_loop',
'bootscore_before_loop_item',
'bootscore_custom_loop_item',
'bootscore_before_loop_thumbnail',
'bootscore_after_loop_thumbnail',
'bootscore_before_loop_title',
'bootscore_after_loop_title',
'bootscore_after_loop_tags',
'bootscore_loop_item_after_card_body',
'bootscore_after_loop_item',
'bootscore_after_loop',
'bootscore_after_featured_image',
'bootscore_before_entry_footer',
'bootscore_before_loop_pagination',
'bootscore_loop_pagination',
'bootscore_before_sidebar_widgets',
'bootscore_after_sidebar_widgets',
'bootscore_before_my_offcanvas_account',
'bootscore_before_footer',
'bootscore_footer_columns_before_container',
'bootscore_footer_columns_after_container_open',
'bootscore_footer_columns_before_container_close',
'bootscore_footer_columns_after_container',
'bootscore_footer_info_after_container_open',
'bootscore_before_mini_cart_footer',
];
// Add hooks dynamically
foreach ($bootscore_hooks as $hook) {
add_action($hook, function ($location = null) use ($hook) {
$output = '<div class="alert alert-warning"><code>' . esc_html($hook) . '</code>';
if ($location) {
$output .= ' (Location: <strong>' . esc_html($location) . '</strong>)';
}
$output .= '</div>';
echo $output;
});
}
Action reference list
bootscore_before_masthead
header.phpbootscore_after_masthead_open
header.phpbootscore_before_navbar_brand
header.phpbootscore_after_navbar_brand
header.phpbootscore_after_nav_toggler
header.phpbootscore_before_masthead_close
header.phpbootscore_after_masthead
header.phpbootscore_after_primary_open($location)
404.php, archive.php, index.php, page.php, search.php, single.php, woocommerce.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_before_title($location)
404.php, archive.php, index.php, page.php, search.php, single.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_after_title($location)
404.php, archive.php, index.php, page.php, search.php, single.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_before_loop($location)
archive.php, index.php, search.php, /template-parts/search/content-search.phpbootscore_after_loop($location)
archive.php, index.php, search.php, /template-parts/search/content-search.phpbootscore_after_featured_image($location)
page.php, single.php, /page-templates/page-full-width-image.php, /page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_before_entry_footer($location)
page.php, single.php, /page-templates/page-full-width-image.php,/page-templates/page-sidebar-left.php, /page-templates/page-sidebar-none.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_before_single_pagination($location)
single.php, /single-templates/single-full-width-image.php, /single-templates/single-sidebar-left.php, /single-templates/single-sidebar-none.phpbootscore_before_sidebar_widgets
sidebar.php.phpbootscore_after_sidebar_widgets
sidebar.php.phpbootscore_before_my_offcanvas_account
/template-parts/header/offcanvas-woocommerce.phpbootscore_before_footer
footer.phpbootscore_footer_columns_before_container
footer.phpbootscore_footer_columns_after_container_open
footer.phpbootscore_footer_columns_after_container_open
footer.phpbootscore_footer_columns_before_container_close
footer.phpbootscore_footer_columns_after_container
footer.phpbootscore_footer_info_after_container_open
footer.phpbootscore_before_mini_cart_footer
/woocommerce/cart/mini-cart.php
Loop
bootscore_before_loop_item($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.php, custom.phpbootscore_custom_loop_item
custom.phpbootscore_before_loop_thumbnail($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore_after_loop_thumbnail($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore_before_loop_title($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore_after_loop_title($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore_after_loop_tags($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.phpbootscore_loop_item_after_card_body($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.phpbootscore_after_loop_item($location)
cards-grid-term.php, cards-grid.php, cards-horizontal-term.php, cards-horizontal.php, cards-overlay-term.php, cards-overlay.php, custom.phpbootscore_before_loop_pagination
archive.php, index.php, search.phpbootscore_loop_pagination
archive.php, index.php, search.php