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