Yoast\WP\SEO\Editors\Framework\Seo\Terms

Title_Data_Provider{} │ Yoast 1.0└─ 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

Методы

  1. public get_data()
  2. public get_title_template( bool $fallback = true )
  3. public Title( $this->get_title_template(), $this->get_title_template( false ) )
  4. ERROR: no method name found on line `}`
  5. ERROR: no method name found on line ``
  6. ERROR: no method name found on line ``

Код 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 ) );
	}
}