add text before price
-
If you need to add text before, for example: “from” 10$.
function tec_remove_price_range( $cost, $post_id, $with_currency_symbol ) {
$pieces = explode( ' – ', $cost );
// If the ticket is free, just display it.
if ( $cost == 'Free' ) {
return $cost;
}
// Remove the block you don't need!
// To show the lowest price with some text.
if ( ! empty( $pieces[0] ) ) {
return "From: " . $pieces[0];
}
// To show the highest price.
if ( ! empty( $pieces[1] ) ) {
return "Up to " . $pieces[1];
}
// If not a range, return the default value.
return $cost;
}
add_filter( 'tribe_get_cost', 'tec_remove_price_range', 10, 3 );
- You must be logged in to reply to this topic.