From 49dce31f70019e725ffbf8fcf75fe82be0b959f0 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 25 Feb 2010 08:56:19 +0000 Subject: [PATCH] Deprecate automatic_feed_links() in favor of add_theme_support('automatic-feed-links'). Props Viper007Bond. Fixes #12364 git-svn-id: https://develop.svn.wordpress.org/trunk@13398 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-content/themes/classic/functions.php | 2 +- wp-content/themes/default/functions.php | 2 +- wp-content/themes/twentyten/functions.php | 6 +++--- wp-includes/default-filters.php | 11 ++++++----- wp-includes/deprecated.php | 12 ++++++++++++ wp-includes/general-template.php | 19 +++---------------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/wp-content/themes/classic/functions.php b/wp-content/themes/classic/functions.php index 1bc06e22ad..fc379f29cf 100644 --- a/wp-content/themes/classic/functions.php +++ b/wp-content/themes/classic/functions.php @@ -4,7 +4,7 @@ * @subpackage Classic_Theme */ -automatic_feed_links(); +add_theme_support( 'automatic-feed-links' ); if ( function_exists('register_sidebar') ) register_sidebar(array( diff --git a/wp-content/themes/default/functions.php b/wp-content/themes/default/functions.php index ec727c8a28..f8d2b1cc5a 100644 --- a/wp-content/themes/default/functions.php +++ b/wp-content/themes/default/functions.php @@ -6,7 +6,7 @@ $content_width = 450; -automatic_feed_links(); +add_theme_support( 'automatic-feed-links' ); if ( function_exists('register_sidebar') ) { register_sidebar(array( diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 7fcf506206..99f13a1444 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -2,7 +2,7 @@ // Set the content width based on the Theme CSS if ( ! isset( $content_width ) ) - $content_width = 640; + $content_width = 640; if ( ! function_exists( 'twentyten_init' ) ) : function twentyten_init() { @@ -26,8 +26,8 @@ function twentyten_init() { // so we want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit) set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); - // Add default posts and comments RSS feed links to head. - automatic_feed_links(); + // Add default posts and comments RSS feed links to head + add_theme_support( 'automatic-feed-links' ); // Make theme available for translation // Translations can be filed in the /languages/ directory diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 4a5d0f96a7..26d6aa3135 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -168,8 +168,9 @@ add_filter( 'editable_slug', 'urldecode' ); add_filter( 'atom_service_url','atom_service_url_filter' ); // Actions -add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); -add_action( 'wp_head', 'feed_links_extra', 3 ); +add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); +add_action( 'wp_head', 'feed_links', 3 ); +add_action( 'wp_head', 'feed_links_extra', 3 ); add_action( 'wp_head', 'rsd_link' ); add_action( 'wp_head', 'wlwmanifest_link' ); add_action( 'wp_head', 'index_rel_link' ); @@ -178,9 +179,9 @@ add_action( 'wp_head', 'start_post_rel_link', 10, 0 ); add_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); add_action( 'wp_head', 'locale_stylesheet' ); add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 ); -add_action( 'wp_head', 'noindex', 1 ); -add_action( 'wp_head', 'wp_print_styles', 8 ); -add_action( 'wp_head', 'wp_print_head_scripts', 9 ); +add_action( 'wp_head', 'noindex', 1 ); +add_action( 'wp_head', 'wp_print_styles', 8 ); +add_action( 'wp_head', 'wp_print_head_scripts', 9 ); add_action( 'wp_head', 'wp_generator' ); add_action( 'wp_head', 'rel_canonical' ); add_action( 'wp_footer', 'wp_print_footer_scripts' ); diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index a7c7e1958d..c4618bc53b 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2411,4 +2411,16 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) { do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); return true; +} + +/** + * Enable automatic general feed link outputting. + * + * @since 2.8.0 + * @deprecated 3.0.0 + * @deprecated Use add_theme_support( 'automatic-feed-links' ) + */ +function automatic_feed_links() { + _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" ); + add_theme_support( 'automatic-feed-links' ); } \ No newline at end of file diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index ce4c75f2c1..f6f0fabf67 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -1561,22 +1561,6 @@ function wp_footer() { do_action('wp_footer'); } -/** - * Enable/disable automatic general feed link outputting. - * - * @since 2.8.0 - * - * @param boolean $add Optional, default is true. Add or remove links. Defaults to true. - */ -function automatic_feed_links( $add = true ) { - if ( $add ) - add_action( 'wp_head', 'feed_links', 2 ); - else { - remove_action( 'wp_head', 'feed_links', 2 ); - remove_action( 'wp_head', 'feed_links_extra', 3 ); - } -} - /** * Display the links to the general feeds. * @@ -1585,6 +1569,9 @@ function automatic_feed_links( $add = true ) { * @param array $args Optional arguments. */ function feed_links( $args = array() ) { + if ( !current_theme_supports('automatic-feed-links') ) + return; + $defaults = array( /* translators: Separator between blog name and feed type in feed links */ 'separator' => _x('»', 'feed link'),