我正在尝试挂钩这个PHP代码并让它说“请至少预订%d天”之外的任何帮助将不胜感激,谢谢。
$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;
答案 0 :(得分:0)
这将更改WordPress主题中的单行文本。如果你想使用它,只需用你的文本更改我的文本并放在子主题函数.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 );
如果您想更改WordPress主题中的多行文字,请使用以下代码。
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 );