WPSEO_Sitemaps_Renderer::get_stylesheet_url │ protected │ Yoast 1.0

Retrieves the stylesheet URL that should be used in the current environment.

When home_url and site_url are not the same, the home_url should be used. This is because the stylesheet needs to be served from the same domain, protocol and port as the XML file that is loading it.

Метод класса: WPSEO_Sitemaps_Renderer{}

Хуки из метода

Возвращает

string. The stylesheet URL that needs to be used.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_stylesheet_url();

Код WPSEO_Sitemaps_Renderer::get_stylesheet_url() Yoast 28.9

protected function get_stylesheet_url() {
	if ( home_url() !== site_url() ) {
		/**
		 * Filter the public URL of the sitemap stylesheet.
		 *
		 * @param string $url The stylesheet URL.
		 */
		return apply_filters( 'wpseo_sitemap_public_url', home_url( 'main-sitemap.css' ) );
	}

	/*
	 * Fallback to circumvent a cross-domain security problem when the stylesheet is
	 * loaded from a different (sub)domain.
	 */
	if ( strpos( plugins_url(), home_url() ) !== 0 ) {
		return home_url( 'main-sitemap.css' );
	}

	return plugin_dir_url( WPSEO_FILE ) . 'css/main-sitemap.css';
}