WPSEO_Schema_HowTo::add_duration() private Yoast 1.0
Adds the duration of the task to the Schema.
{} Это метод класса: WPSEO_Schema_HowTo{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
// private - только в коде основоного (родительского) класса $result = $this->add_duration( $data, $attributes );
- $data(массив) (обязательный)
- Our How-To schema data.
- $attributes(массив) (обязательный)
- The block data attributes.
Код WPSEO_Schema_HowTo::add_duration() WPSEO Schema HowTo::add duration Yoast 16.1.1
private function add_duration( &$data, $attributes ) {
if ( empty( $attributes['hasDuration'] ) ) {
return;
}
$days = empty( $attributes['days'] ) ? 0 : $attributes['days'];
$hours = empty( $attributes['hours'] ) ? 0 : $attributes['hours'];
$minutes = empty( $attributes['minutes'] ) ? 0 : $attributes['minutes'];
if ( ( $days + $hours + $minutes ) > 0 ) {
$data['totalTime'] = \esc_attr( 'P' . $days . 'DT' . $hours . 'H' . $minutes . 'M' );
}
}