WP_Sitemaps_Stylesheet::render_stylesheet() WordPress Method

The WP_Sitemaps_Stylesheet::render_stylesheet() method is used to render a stylesheet for a sitemap. This stylesheet can be used to style the sitemap XML output.

WP_Sitemaps_Stylesheet::render_stylesheet( string $type ) #

Renders the XSL stylesheet depending on whether it’s the sitemap index or not.


Parameters

$type

(string)(Required)Stylesheet type. Either 'sitemap' or 'index'.


Top ↑

Source

File: wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php

	public function render_stylesheet( $type ) {
		header( 'Content-type: application/xml; charset=UTF-8' );

		if ( 'sitemap' === $type ) {
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below.
			echo $this->get_sitemap_stylesheet();
		}

		if ( 'index' === $type ) {
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below.
			echo $this->get_sitemap_index_stylesheet();
		}

		exit;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.