mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the separator, and a way to short-circuit title generation. Plugins can now also check for theme support and reliably filter the entire output. See #18548. Deprecates `wp_title()`. Fixes #31078. git-svn-id: https://develop.svn.wordpress.org/trunk@35294 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+21
-21
@@ -91,53 +91,53 @@ function get_default_feed() {
|
||||
* Retrieve the blog title for the feed title.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 4.4.0 Deprecated argument.
|
||||
*
|
||||
* @param string $sep Optional. How to separate the title. See wp_title() for more info.
|
||||
* @return string Error message on failure or blog title on success.
|
||||
* @param string $deprecated Deprecated.
|
||||
* @return string The document title.
|
||||
*/
|
||||
function get_wp_title_rss( $sep = '»' ) {
|
||||
$title = wp_title( $sep, false );
|
||||
|
||||
if ( is_wp_error( $title ) ) {
|
||||
return $title->get_error_message();
|
||||
}
|
||||
|
||||
if ( $title && $sep && ' ' !== substr( $title, 0, 1 ) ) {
|
||||
$title = " $sep " . $title;
|
||||
function get_wp_title_rss( $deprecated = '–' ) {
|
||||
if ( '–' !== $deprecated ) {
|
||||
_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the blog title for use as the feed title.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 4.4.0 Deprecated argument.
|
||||
*
|
||||
* @param string $title The current blog title.
|
||||
* @param string $sep Separator used by wp_title().
|
||||
* @param string $title The current blog title.
|
||||
* @param string $deprecated Deprecated.
|
||||
*/
|
||||
$title = apply_filters( 'get_wp_title_rss', $title, $sep );
|
||||
return $title;
|
||||
return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the blog title for display of the feed title.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @see wp_title() $sep parameter usage.
|
||||
* @since 4.4.0 Deprecated argument.
|
||||
*
|
||||
* @param string $sep Optional.
|
||||
* @param string $deprecated Optional.
|
||||
*/
|
||||
function wp_title_rss( $sep = '»' ) {
|
||||
function wp_title_rss( $deprecated = '–' ) {
|
||||
if ( '–' !== $deprecated ) {
|
||||
_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the blog title for display of the feed title.
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @since 4.4.0 Deprecated argument.
|
||||
*
|
||||
* @see get_wp_title_rss()
|
||||
*
|
||||
* @param string $wp_title The current blog title.
|
||||
* @param string $sep Separator used by wp_title().
|
||||
* @param string $wp_title_rss The current blog title.
|
||||
* @param string $deprecated Deprecated.
|
||||
*/
|
||||
echo apply_filters( 'wp_title_rss', get_wp_title_rss( $sep ), $sep );
|
||||
echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user