[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Twenty Fifteen back compat functionality 4 * 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. 8 * 9 * @package WordPress 10 * @subpackage Twenty_Fifteen 11 * @since Twenty Fifteen 1.0 12 */ 13 14 /** 15 * Prevent switching to Twenty Fifteen on old versions of WordPress. 16 * 17 * Switches to the default theme. 18 * 19 * @since Twenty Fifteen 1.0 20 */ 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' ); 25 } 26 add_action( 'after_switch_theme', 'twentyfifteen_switch_theme' ); 27 28 /** 29 * Add message for unsuccessful theme switch. 30 * 31 * Prints an update nag after an unsuccessful attempt to switch to 32 * Twenty Fifteen on WordPress versions prior to 4.1. 33 * 34 * @since Twenty Fifteen 1.0 35 */ 36 function twentyfifteen_upgrade_notice() { 37 printf( 38 '<div class="error"><p>%s</p></div>', 39 sprintf( 40 /* translators: %s: WordPress version. */ 41 __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), 42 $GLOBALS['wp_version'] 43 ) 44 ); 45 } 46 47 /** 48 * Prevent the Customizer from being loaded on WordPress versions prior to 4.1. 49 * 50 * @since Twenty Fifteen 1.0 51 */ 52 function twentyfifteen_customize() { 53 wp_die( 54 sprintf( 55 /* translators: %s: WordPress version. */ 56 __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), 57 $GLOBALS['wp_version'] 58 ), 59 '', 60 array( 61 'back_link' => true, 62 ) 63 ); 64 } 65 add_action( 'load-customize.php', 'twentyfifteen_customize' ); 66 67 /** 68 * Prevent the Theme Preview from being loaded on WordPress versions prior to 4.1. 69 * 70 * @since Twenty Fifteen 1.0 71 */ 72 function twentyfifteen_preview() { 73 if ( isset( $_GET['preview'] ) ) { 74 wp_die( 75 sprintf( 76 /* translators: %s: WordPress version. */ 77 __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), 78 $GLOBALS['wp_version'] 79 ) 80 ); 81 } 82 } 83 add_action( 'template_redirect', 'twentyfifteen_preview' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |