From 473772f395a6d20999a4bf54ea000269e6ccafc4 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Mon, 3 May 2010 09:57:24 +0000 Subject: [PATCH] First pass of compatibility code for old themes which relied on using templates from the default theme without expressly identifying it as the parent theme. Fixes #12425 and #13009. The fallback to these template files is now depreceated and will be removed in a future version. git-svn-id: https://develop.svn.wordpress.org/trunk@14365 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment-template.php | 4 +- wp-includes/general-template.php | 18 +-- wp-includes/theme-compat/comments-popup.php | 129 ++++++++++++++++++++ wp-includes/theme-compat/comments.php | 101 +++++++++++++++ wp-includes/theme-compat/footer.php | 31 +++++ wp-includes/theme-compat/header.php | 50 ++++++++ wp-includes/theme-compat/sidebar.php | 88 +++++++++++++ wp-includes/theme.php | 8 +- 8 files changed, 414 insertions(+), 15 deletions(-) create mode 100644 wp-includes/theme-compat/comments-popup.php create mode 100644 wp-includes/theme-compat/comments.php create mode 100644 wp-includes/theme-compat/footer.php create mode 100644 wp-includes/theme-compat/header.php create mode 100644 wp-includes/theme-compat/sidebar.php diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index e5a2254672..2247f0a063 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -889,8 +889,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false require( $include ); elseif ( file_exists( TEMPLATEPATH . $file ) ) require( TEMPLATEPATH . $file ); - else - require( get_theme_root() . '/'.WP_FALLBACK_THEME.'/comments.php'); + else // Backward compat code will be removed in a future release + require( WPINC . '/theme-compat/comments.php'); } /** diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index e5130b58a4..d5ed674db2 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -10,8 +10,7 @@ * Load header template. * * Includes the header template for a theme or if a name is specified then a - * specialised header will be included. If the theme contains no header.php file - * then the header from the WP_FALLBACK_THEME theme will be included. + * specialised header will be included. * * For the parameter, if the file is called "header-special.php" then specify * "special". @@ -31,16 +30,16 @@ function get_header( $name = null ) { $templates[] = "header.php"; + // Backward compat code will be removed in a future release if ('' == locate_template($templates, true)) - load_template( get_theme_root() . '/'. WP_FALLBACK_THEME. '/header.php'); + load_template( WPINC . '/theme-compat/header.php'); } /** * Load footer template. * * Includes the footer template for a theme or if a name is specified then a - * specialised footer will be included. If the theme contains no footer.php file - * then the footer from the default theme will be included. + * specialised footer will be included. * * For the parameter, if the file is called "footer-special.php" then specify * "special". @@ -60,16 +59,16 @@ function get_footer( $name = null ) { $templates[] = "footer.php"; + // Backward compat code will be removed in a future release if ('' == locate_template($templates, true)) - load_template( get_theme_root() . '/' . WP_FALLBACK_THEME . '/footer.php'); + load_template( WPINC . '/theme-compat/footer.php'); } /** * Load sidebar template. * * Includes the sidebar template for a theme or if a name is specified then a - * specialised sidebar will be included. If the theme contains no sidebar.php - * file then the sidebar from the default theme will be included. + * specialised sidebar will be included. * * For the parameter, if the file is called "sidebar-special.php" then specify * "special". @@ -89,8 +88,9 @@ function get_sidebar( $name = null ) { $templates[] = "sidebar.php"; + // Backward compat code will be removed in a future release if ('' == locate_template($templates, true)) - load_template( get_theme_root() . '/' . WP_FALLBACK_THEME . '/sidebar.php'); + load_template( WPINC . '/theme-compat/sidebar.php'); } /** diff --git a/wp-includes/theme-compat/comments-popup.php b/wp-includes/theme-compat/comments-popup.php new file mode 100644 index 0000000000..7223d407f1 --- /dev/null +++ b/wp-includes/theme-compat/comments-popup.php @@ -0,0 +1,129 @@ + + + + <?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?> + + + + + + + +

+ + +

Comments

+ +

RSS feed for comments on this post.

+ + +

The URL to TrackBack this entry is:

+ + + + + +
    + +
  1. + +

    by @

    +
  2. + + +
+ +

No comments yet.

+ + + +

Leave a comment

+

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:

+ +
+ +

Logged in as . Log out »

+ +

+ + +

+ +

+ + +

+ +

+ + +

+ + +

+ +
+ +

+ +

+ + " /> + +

+ ID); ?> +
+ +

Sorry, the comment form is closed at this time.

+ + +
Close this window.
+ + +

Sorry, no posts matched your criteria.

+ + + +

Powered by WordPress

+ + + + \ No newline at end of file diff --git a/wp-includes/theme-compat/comments.php b/wp-includes/theme-compat/comments.php new file mode 100644 index 0000000000..e10ce6032e --- /dev/null +++ b/wp-includes/theme-compat/comments.php @@ -0,0 +1,101 @@ + +

This post is password protected. Enter the password to view comments.

+ + + + + +

to “

+ + + +
    + +
+ + + + + + + + + +

Comments are closed.

+ + + + + + + +
+ +

+ +
+ +
+ + +

You must be logged in to post a comment.

+ + +
+ + + +

Logged in as . Log out »

+ + + +

/> +

+ +

/> +

+ +

+

+ + + + + +

+ +

+ +

+ID); ?> + +
+ + +
+ + diff --git a/wp-includes/theme-compat/footer.php b/wp-includes/theme-compat/footer.php new file mode 100644 index 0000000000..975e9bfe8c --- /dev/null +++ b/wp-includes/theme-compat/footer.php @@ -0,0 +1,31 @@ + + +
+ + + + + + + + + diff --git a/wp-includes/theme-compat/header.php b/wp-includes/theme-compat/header.php new file mode 100644 index 0000000000..77da5c5ca6 --- /dev/null +++ b/wp-includes/theme-compat/header.php @@ -0,0 +1,50 @@ + + +> + + + + +<?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?> + + + + + + + + + + +> +
+ + + +
diff --git a/wp-includes/theme-compat/sidebar.php b/wp-includes/theme-compat/sidebar.php new file mode 100644 index 0000000000..e81f2f3f27 --- /dev/null +++ b/wp-includes/theme-compat/sidebar.php @@ -0,0 +1,88 @@ + + + diff --git a/wp-includes/theme.php b/wp-includes/theme.php index f4250b1945..00db024657 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -983,9 +983,7 @@ function get_attachment_template() { * Retrieve path of comment popup template in current or parent template. * * Checks for comment popup template in current template, if it exists or in the - * parent template. If it doesn't exist, then it retrieves the comment-popup.php - * file from the WP_FALLBACK_THEME theme. The WP_FALLBACK_THEME theme must then exist for it to - * work. + * parent template. * * @since 1.5.0 * @uses apply_filters() Calls 'comments_popup_template' filter on path. @@ -994,8 +992,10 @@ function get_attachment_template() { */ function get_comments_popup_template() { $template = locate_template(array("comments-popup.php")); + + // Backward compat code will be removed in a future release if ('' == $template) - $template = get_theme_root() . '/' . WP_FALLBACK_THEME . '/comments-popup.php'; + $template = WPINC . '/theme-compat/comments-popup.php'; return apply_filters('comments_popup_template', $template); }