I am trying to hook into this PHP code and make it say something other than "Please booking at least %d day(s)" any help would be appreciated, thanks.
$unit = st()->get_option( 'cars_price_unit' , 'day' );
if ($unit == 'day' and $booking_min_day and $booking_min_day >
self::get_date_diff($check_in_timestamp,$check_out_timestamp)) {
STTemplate::set_message( sprintf(__( 'Please booking at least %d day(s)' ,
ST_TEXTDOMAIN ), $booking_min_day) , 'danger' );
$pass_validate = false;
return false;
This will change a single line of text in your WordPress theme. If you want to use it just change out my text with yours and place in child theme functions.php
function my_change_translate_text( $translated_text ) {
if ( $translated_text == 'Please booking at least %d day(s)' ) {
$translated_text = 'Minimum Rental: %d day(s)';
}
return $translated_text;
}
add_filter( 'gettext', 'my_change_translate_text', 20 );
If you want to change multiple lines of text in a WordPress theme then use this code below.
function my_change_translate_text_multiple( $translated ) {
$text = array(
'Old Text 1' => 'New Translation 1',
'Old Text 2' => 'New Translation 2',
'Old Text 3' => 'New Translation 3',
);
$translated = str_ireplace( array_keys($text), $text, $translated );
return $translated;
}
add_filter( 'gettext', 'my_change_translate_text_multiple', 20 );
This was taken from http://ronangelo.com/