Yoast\WP\SEO\Editors\Framework\Seo\Terms
Title_Data_Provider{}└─ Title_Data_Provider_Interface, Abstract_Term_Seo_Data_Provider
Describes if the title SEO data.
Хуков нет.
Использование
$Title_Data_Provider = new Title_Data_Provider(); // use class methods
Методы
- public get_data()
- public get_title_template( bool $fallback = true )
- public Title( $this->get_title_template(), $this->get_title_template( false ) )
- ERROR: no method name found on line `}`
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
Код Title_Data_Provider{} Title Data Provider{} Yoast 28.9
class Title_Data_Provider extends Abstract_Term_Seo_Data_Provider implements Title_Data_Provider_Interface {
/**
* Retrieves the title template.
*
* @param bool $fallback Whether to return the hardcoded fallback if the template value is empty.
*
* @return string The title template.
*/
public function get_title_template( bool $fallback = true ): string {
$title = $this->get_template( 'title' );
if ( $title === '' && $fallback === true ) {
/* translators: %s expands to the variable used for term title. */
$archives = \sprintf( \__( '%s Archives', 'wordpress-seo' ), '%%term_title%%' );
return $archives . ' %%page%% %%sep%% %%sitename%%';
}
return $title;
}
/**
* Method to return the Title domain object with SEO data.
*
* @return Seo_Plugin_Data_Interface The specific seo data.
*/
public function get_data(): Seo_Plugin_Data_Interface {
return new Title( $this->get_title_template(), $this->get_title_template( false ) );
}
}