15 * Prevent switching to Twenty Thirteen on old versions of WordPress. |
15 * Prevent switching to Twenty Thirteen on old versions of WordPress. |
16 * |
16 * |
17 * Switches to the default theme. |
17 * Switches to the default theme. |
18 * |
18 * |
19 * @since Twenty Thirteen 1.0 |
19 * @since Twenty Thirteen 1.0 |
20 * |
|
21 * @return void |
|
22 */ |
20 */ |
23 function twentythirteen_switch_theme() { |
21 function twentythirteen_switch_theme() { |
24 switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); |
22 switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME ); |
25 unset( $_GET['activated'] ); |
23 unset( $_GET['activated'] ); |
26 add_action( 'admin_notices', 'twentythirteen_upgrade_notice' ); |
24 add_action( 'admin_notices', 'twentythirteen_upgrade_notice' ); |
32 * |
30 * |
33 * Prints an update nag after an unsuccessful attempt to switch to |
31 * Prints an update nag after an unsuccessful attempt to switch to |
34 * Twenty Thirteen on WordPress versions prior to 3.6. |
32 * Twenty Thirteen on WordPress versions prior to 3.6. |
35 * |
33 * |
36 * @since Twenty Thirteen 1.0 |
34 * @since Twenty Thirteen 1.0 |
37 * |
|
38 * @return void |
|
39 */ |
35 */ |
40 function twentythirteen_upgrade_notice() { |
36 function twentythirteen_upgrade_notice() { |
41 $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'] ); |
37 $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'] ); |
42 printf( '<div class="error"><p>%s</p></div>', $message ); |
38 printf( '<div class="error"><p>%s</p></div>', $message ); |
43 } |
39 } |
44 |
40 |
45 /** |
41 /** |
46 * Prevent the Theme Customizer from being loaded on WordPress versions prior to 3.6. |
42 * Prevent the Customizer from being loaded on WordPress versions prior to 3.6. |
47 * |
43 * |
48 * @since Twenty Thirteen 1.0 |
44 * @since Twenty Thirteen 1.0 |
49 * |
|
50 * @return void |
|
51 */ |
45 */ |
52 function twentythirteen_customize() { |
46 function twentythirteen_customize() { |
53 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( |
47 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( |
54 'back_link' => true, |
48 'back_link' => true, |
55 ) ); |
49 ) ); |
58 |
52 |
59 /** |
53 /** |
60 * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4. |
54 * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4. |
61 * |
55 * |
62 * @since Twenty Thirteen 1.0 |
56 * @since Twenty Thirteen 1.0 |
63 * |
|
64 * @return void |
|
65 */ |
57 */ |
66 function twentythirteen_preview() { |
58 function twentythirteen_preview() { |
67 if ( isset( $_GET['preview'] ) ) { |
59 if ( isset( $_GET['preview'] ) ) { |
68 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'] ) ); |
60 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'] ) ); |
69 } |
61 } |