Yoast\WP\SEO\Presenters\Slack
Enhanced_Data_Presenter::get() public Yoast 1.0
Gets the enhanced data array.
{} Это метод класса: Enhanced_Data_Presenter{}
Хуки из метода
Возвращает
Массив. The enhanced data array
Использование
$Enhanced_Data_Presenter = new Enhanced_Data_Presenter(); $Enhanced_Data_Presenter->get();
Код Enhanced_Data_Presenter::get() Enhanced Data Presenter::get Yoast 15.6.2
public function get() {
$data = [];
$author_id = $this->presentation->source->post_author;
$estimated_reading_time = $this->presentation->estimated_reading_time_minutes;
if ( \is_singular( 'post' ) && $author_id ) {
$data[ \__( 'Written by', 'wordpress-seo' ) ] = \get_the_author_meta( 'display_name', $author_id );
}
if ( ! empty( $estimated_reading_time ) ) {
/* translators: %s expands to the reading time number, in minutes */
$data[ \__( 'Est. reading time', 'wordpress-seo' ) ] = \sprintf( \_n( '%s minute', '%s minutes', $estimated_reading_time, 'default' ), $estimated_reading_time );
}
/**
* Filter: 'wpseo_enhanced_slack_data' - Allows filtering of the enhanced data for sharing on Slack.
*
* @api array $data The enhanced Slack sharing data.
*
* @param Indexable_Presentation $presentation The presentation of an indexable.
*/
return \apply_filters( 'wpseo_enhanced_slack_data', $data, $this->presentation );
}