Contents
Pluggable functions are wrapped in if (!function_exists('function_name')) : … endif; and fetched in functions.php and woocommerce/wc-functions.php.
if (!function_exists('function_name')) :
// Function
endif;
Functions can be overridden by copying the function between the if and endif to the child’s functions.php.
Example: Changing the breadcrumb
// Breadcrumb
function the_breadcrumb() {
if (!is_home()) {
echo '<nav aria-label="breadcrumb" class="mb-4 mt-2">';
echo '<ol class="breadcrumb mb-0">';
echo '<li class="breadcrumb-item"><a href="' . home_url() . '">' . 'Home' . '</a></li>';
// display parent category names with links
if (is_category() || is_single()) {
$cat_IDs = wp_get_post_categories(get_the_ID());
foreach ($cat_IDs as $cat_ID) {
$cat = get_category($cat_ID);
echo '<li class="breadcrumb-item"><a href="' . get_term_link($cat->term_id) . '">' . $cat->name . '</a></li>';
}
}
// display current page name
if (is_page() || is_single()) {
echo '<li class="breadcrumb-item active" aria-current="page">' . get_the_title() . '</li>';
}
echo '</ol>';
echo '</nav>';
}
}
Useful functions
inc/breadcrumb.php– Breadcrumbinc/widgets.php– Widgetsinc/pagination.php– Paginationinc/template-tags.php– Categories badge, tags badge, featured image, author, date, comments countwoocommerce/inc/breadcrumb.php– WooCommerce breadcrumbwoocommerce/inc/wc-mini-cart.php– Cart content in navbar mini-cart. Note that this function is AJAX loaded. When doing changes there, you must add or remove something in your cart. Reloading the page has no effect.