]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-content/themes/twentythirteen/inc/back-compat.php
Wordpress 3.6
[autoinstalls/wordpress.git] / wp-content / themes / twentythirteen / inc / back-compat.php
1 <?php
2 /**
3  * Twenty Thirteen back compat functionality.
4  *
5  * Prevents Twenty Thirteen from running on WordPress versions prior to 3.6,
6  * since this theme is not meant to be backwards compatible and relies on
7  * many new functions and markup changes introduced in 3.6.
8  *
9  * @package WordPress
10  * @subpackage Twenty_Thirteen
11  * @since Twenty Thirteen 1.0
12  */
13
14 /**
15  * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches
16  * to the default theme.
17  *
18  * @since Twenty Thirteen 1.0
19  *
20  * @return void
21  */
22 function twentythirteen_switch_theme() {
23         switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
24         unset( $_GET['activated'] );
25         add_action( 'admin_notices', 'twentythirteen_upgrade_notice' );
26 }
27 add_action( 'after_switch_theme', 'twentythirteen_switch_theme' );
28
29 /**
30  * Prints an update nag after an unsuccessful attempt to switch to
31  * Twenty Thirteen on WordPress versions prior to 3.6.
32  *
33  * @since Twenty Thirteen 1.0
34  *
35  * @return void
36  */
37 function twentythirteen_upgrade_notice() {
38         $message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] );
39         printf( '<div class="error"><p>%s</p></div>', $message );
40 }
41
42 /**
43  * Prevents the Customizer from being loaded on WordPress versions prior to 3.6.
44  *
45  * @since Twenty Thirteen 1.0
46  *
47  * @return void
48  */
49 function twentythirteen_customize() {
50         wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ), '', array(
51                 'back_link' => true,
52         ) );
53 }
54 add_action( 'load-customize.php', 'twentythirteen_customize' );
55
56 /**
57  * Prevents the Theme Preview from being loaded on WordPress versions prior to 3.4.
58  *
59  * @since Twenty Thirteen 1.0
60  *
61  * @return void
62  */
63 function twentythirteen_preview() {
64         if ( isset( $_GET['preview'] ) ) {
65                 wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ) );
66         }
67 }
68 add_action( 'template_redirect', 'twentythirteen_preview' );