Skip to content

Instantly share code, notes, and snippets.

@jmabbas
Created January 16, 2026 09:41
Show Gist options
  • Select an option

  • Save jmabbas/23399a9b04c78c7e139fa0d7c3383f22 to your computer and use it in GitHub Desktop.

Select an option

Save jmabbas/23399a9b04c78c7e139fa0d7c3383f22 to your computer and use it in GitHub Desktop.
My Travel - Results
function mytravel_wc_product_page_title() {
$total = wc_get_loop_prop( 'total' );
if ( is_shop() || is_product_category() || is_tax( 'product_label' ) || is_tax( get_object_taxonomies( 'product' ) ) ) {
$page_title = woocommerce_page_title( false );
$title = str_replace( 'product-format-', '', $page_title );
} else {
$title = get_the_title();
}
?>
<h2 class="font-size-21 font-weight-bold mb-0 text-lh-1">
<?php
echo wp_kses_post(
sprintf(
/* translators: %1$s: page title, %2$d: total result */
wp_kses_post( _n( '<span class="page-title">%1$s:</span> %2$d result found', '<span class="page-title">%1$s:</span> %2$d results found', $total, 'mytravel' ) ),
$title,
number_format_i18n( $total )
)
);
?>
</h2>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment