3 * Twenty Sixteen back compat functionality
5 * Prevents Twenty Sixteen from running on WordPress versions prior to 4.4,
6 * since this theme is not meant to be backward compatible beyond that and
7 * relies on many newer functions and markup changes introduced in 4.4.
10 * @subpackage Twenty_Sixteen
11 * @since Twenty Sixteen 1.0
15 * Prevent switching to Twenty Sixteen on old versions of WordPress.
17 * Switches to the default theme.
19 * @since Twenty Sixteen 1.0
21 function twentysixteen_switch_theme() {
22 switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
24 unset( $_GET['activated'] );
26 add_action( 'admin_notices', 'twentysixteen_upgrade_notice' );
28 add_action( 'after_switch_theme', 'twentysixteen_switch_theme' );
31 * Adds a message for unsuccessful theme switch.
33 * Prints an update nag after an unsuccessful attempt to switch to
34 * Twenty Sixteen on WordPress versions prior to 4.4.
36 * @since Twenty Sixteen 1.0
38 * @global string $wp_version WordPress version.
40 function twentysixteen_upgrade_notice() {
41 $message = sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] );
42 printf( '<div class="error"><p>%s</p></div>', $message );
46 * Prevents the Customizer from being loaded on WordPress versions prior to 4.4.
48 * @since Twenty Sixteen 1.0
50 * @global string $wp_version WordPress version.
52 function twentysixteen_customize() {
53 wp_die( sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ), '', array(
57 add_action( 'load-customize.php', 'twentysixteen_customize' );
60 * Prevents the Theme Preview from being loaded on WordPress versions prior to 4.4.
62 * @since Twenty Sixteen 1.0
64 * @global string $wp_version WordPress version.
66 function twentysixteen_preview() {
67 if ( isset( $_GET['preview'] ) ) {
68 wp_die( sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ) );
71 add_action( 'template_redirect', 'twentysixteen_preview' );