3 * Twenty Fifteen back compat functionality
5 * Prevents Twenty Fifteen from running on WordPress versions prior to 4.1,
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.1.
10 * @subpackage Twenty_Fifteen
11 * @since Twenty Fifteen 1.0
15 * Prevent switching to Twenty Fifteen on old versions of WordPress.
17 * Switches to the default theme.
19 * @since Twenty Fifteen 1.0
21 function twentyfifteen_switch_theme() {
22 switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
23 unset( $_GET['activated'] );
24 add_action( 'admin_notices', 'twentyfifteen_upgrade_notice' );
26 add_action( 'after_switch_theme', 'twentyfifteen_switch_theme' );
29 * Add message for unsuccessful theme switch.
31 * Prints an update nag after an unsuccessful attempt to switch to
32 * Twenty Fifteen on WordPress versions prior to 4.1.
34 * @since Twenty Fifteen 1.0
36 function twentyfifteen_upgrade_notice() {
37 $message = sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] );
38 printf( '<div class="error"><p>%s</p></div>', $message );
42 * Prevent the Customizer from being loaded on WordPress versions prior to 4.1.
44 * @since Twenty Fifteen 1.0
46 function twentyfifteen_customize() {
47 wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), '', array(
51 add_action( 'load-customize.php', 'twentyfifteen_customize' );
54 * Prevent the Theme Preview from being loaded on WordPress versions prior to 4.1.
56 * @since Twenty Fifteen 1.0
58 function twentyfifteen_preview() {
59 if ( isset( $_GET['preview'] ) ) {
60 wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ) );
63 add_action( 'template_redirect', 'twentyfifteen_preview' );