Breadcrumbs actions/filters

Action that starts once breadcrumbs is shown on the page

Action name: etheme_page_heading

Action usage:

add_action('etheme_page_heading', function() { ?>
	<div style="background-color: #000;color: #fff;line-height: 1;padding: 12px;">
		 <div>
			 <marquee>This is custom text above page heading on each page has breadcrumbs</marquee>
		</div>
	</div>
<?php }, 5);

Change the number after the function to make it shown before/after breadcrumbs (higher is more under)

Action that starts before breadcrumbs main content

Action name: etheme_before_breadcrumbs

Action usage:

add_action('etheme_before_breadcrumbs', function() { ?>
	<div style="text-align: center;">
		<div>This is custom text above page heading on each page has breadcrumbs</div>
	</div>
<?php }, 5);

Action that starts after breadcrumbs main content

Action name: etheme_after_breadcrumbs

Action usage:

add_action('etheme_after_breadcrumbs', function() { ?>
	<div style="text-align: center;">
		<div>This is custom text below page heading on each page has breadcrumbs</div>
	 </div>
<?php }, 5);

Filter to change title to title with endpoint on my account page

Filter name: etheme_breadcrumbs_page_title

Filter usage:

add_filter ('etheme_breadcrumbs_page_title', 'et_breadcrumbs_title', 10, 1);

function et_breadcrumbs_title($subtitle){
	 if (!class_exists('WooCommerce'))
	 	return $subtitle;<br>
	 if (is_account_page() && is_user_logged_in()){
	 	if (is_wc_endpoint_url()){
			global $wp;
		 	global $wp_query;
		 	$endpoint       = WC()->query->get_current_endpoint();
	 		$action         = isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
		 	$endpoint_title = WC()->query->get_endpoint_title( $endpoint, $action );
		 	if ($endpoint_title){
	 			$subtitle .= ' - '.$endpoint_title;
	 		}
	 	}
	 }
	 return $subtitle;
}

before ->

( without endpoint after title )

after ->

( with page endpoint after title )

Filter to remove shop step from breadcrumbs on product taxonomies pages (some users want to hide it or in some cases, it is shown twice)

Filter name: etheme_breadcrumbs_shop_step

Filter usage:

add_filter( 'etheme_breadcrumbs_shop_step', '__return_false');
Updated on September 26, 2024
Was this Article helpful?