Make WordPress Core

Ticket #23819: 23819.1.diff

File 23819.1.diff, 1.9 KB (added by lancewillett, 9 years ago)
  • wp-content/themes/twentythirteen/functions.php

     
    592592 * Adds support for a custom header image.
    593593 */
    594594require( get_template_directory() . '/inc/custom-header.php' );
     595
     596/**
     597 * Adds back compat handling for WP versions pre-3.6.
     598 */
     599require( get_template_directory() . '/inc/back-compat.php' );
  • wp-content/themes/twentythirteen/inc/back-compat.php

     
     1<?php
     2/**
     3 * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches
     4 * to the previously activated theme or the default theme.
     5 */
     6function twentythirteen_switch_theme( $theme_name, $theme ) {
     7        if ( version_compare( $GLOBALS['wp_version'], '3.6', '>=' ) )
     8                return;
     9
     10        if ( 'twentythirteen' != $theme->template )
     11                switch_theme( $theme->template, $theme->stylesheet );
     12        elseif ( 'twentythirteen' != WP_DEFAULT_THEME )
     13                switch_theme( WP_DEFAULT_THEME );
     14
     15        unset( $_GET['activated'] );
     16        add_action( 'admin_notices', 'twentythirteen_upgrade_notice' );
     17}
     18add_action( 'after_switch_theme', 'twentythirteen_switch_theme', 10, 2 );
     19
     20function twentythirteen_upgrade_notice() {
     21        $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.' ), $GLOBALS['wp_version'] );
     22        printf( '<div class="error"><p>%s</p></div>', $message );
     23}
     24 No newline at end of file