WordPress.org

Make WordPress Core

Ticket #23819: 23819.3.diff

File 23819.3.diff, 2.8 KB (added by obenland, 5 years ago)
  • wp-content/themes/twentythirteen/functions.php

     
    596596/**
    597597 * Adds back compat handling for WP versions pre-3.6.
    598598 */
    599 require( get_template_directory() . '/inc/back-compat.php' );
     599if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) )
     600        require( get_template_directory() . '/inc/back-compat.php' );
  • wp-content/themes/twentythirteen/inc/back-compat.php

     
    11<?php
    22/**
     3 * Prevents Twenty Thirteen from running on WordPress versions prior to 3.6.
     4 *
     5 * Twenty Thirteen is meant to be not backwards compatible, since it relies on
     6 * a lot of new functions and markup changes that were introduced in 3.6.
     7 *
     8 * @package WordPress
     9 * @subpackage Twenty_Thirteen
     10 * @since Twenty Thirteen 1.0
     11 */
     12
     13/**
    314 * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches
    415 * to the previously activated theme or the default theme.
     16 *
     17 * @since Twenty Thirteen 1.0
     18 *
     19 * @param string $theme_name
     20 * @param WP_Theme $theme
     21 * @return void
    522 */
    623function twentythirteen_switch_theme( $theme_name, $theme ) {
    7         if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '>=' ) )
    8                 return;
    9 
    1024        if ( 'twentythirteen' != $theme->template )
    1125                switch_theme( $theme->template, $theme->stylesheet );
    1226        elseif ( 'twentythirteen' != WP_DEFAULT_THEME )
     
    1731}
    1832add_action( 'after_switch_theme', 'twentythirteen_switch_theme', 10, 2 );
    1933
     34/**
     35 * Prints an update nag after an unsuccessful attempt to switch to
     36 * Twenty Thirteen on WordPress versions prior to 3.6.
     37 *
     38 * @since Twenty Thirteen 1.0
     39 *
     40 * @return void
     41 */
    2042function twentythirteen_upgrade_notice() {
    2143        $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] );
    2244        printf( '<div class="error"><p>%s</p></div>', $message );
    23 }
    24  No newline at end of file
     45}
     46
     47/**
     48 * Prevents the Customizer from being loaded on WordPress versions prior to 3.6.
     49 *
     50 * @since Twenty Thirteen 1.0
     51 *
     52 * @return void
     53 */
     54function twentythirteen_customize() {
     55        wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] ) . sprintf( ' <a href="javascript:history.go(-1)">%s</a>', __( 'Go back.' ) ) );
     56}
     57add_action( 'load-customize.php', 'twentythirteen_customize' );