diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index e8fccddaa9..bc6bf1315f 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -34,6 +34,12 @@ if ( ! isset( $content_width ) ) $content_width = 474; +/** + * Twenty Fourteen only works in WordPress 3.6 or later. + */ +if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) + require get_template_directory() . '/inc/back-compat.php'; + if ( ! function_exists( 'twentyfourteen_setup' ) ) : /** * Twenty Fourteen setup. @@ -217,8 +223,6 @@ function twentyfourteen_font_url() { * @return void */ function twentyfourteen_scripts() { - global $wp_styles; - // Add Lato font, used in the main stylesheet. wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); @@ -230,7 +234,7 @@ function twentyfourteen_scripts() { // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131110' ); - $wp_styles->add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); + wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); diff --git a/wp-content/themes/twentyfourteen/inc/back-compat.php b/wp-content/themes/twentyfourteen/inc/back-compat.php new file mode 100644 index 0000000000..dc1ace9cc5 --- /dev/null +++ b/wp-content/themes/twentyfourteen/inc/back-compat.php @@ -0,0 +1,71 @@ +
%s
', $message ); +} + +/** + * Prevent the Theme Customizer from being loaded on WordPress versions prior to 3.6. + * + * @since Twenty Fourteen 1.0 + * + * @return void + */ +function twentyfourteen_customize() { + 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( + 'back_link' => true, + ) ); +} +add_action( 'load-customize.php', 'twentyfourteen_customize' ); + +/** + * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4. + * + * @since Twenty Fourteen 1.0 + * + * @return void + */ +function twentyfourteen_preview() { + if ( isset( $_GET['preview'] ) ) { + 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'] ) ); + } +} +add_action( 'template_redirect', 'twentyfourteen_preview' ); diff --git a/wp-content/themes/twentyfourteen/inc/widgets.php b/wp-content/themes/twentyfourteen/inc/widgets.php index e1d6754a50..4999285bef 100644 --- a/wp-content/themes/twentyfourteen/inc/widgets.php +++ b/wp-content/themes/twentyfourteen/inc/widgets.php @@ -131,22 +131,14 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { else : $images = array(); - if ( function_exists( 'get_post_galleries' ) ) { - $galleries = get_post_galleries( get_the_ID(), false ); - if ( isset( $galleries[0]['ids'] ) ) - $images = explode( ',', $galleries[0]['ids'] ); - } else { - $pattern = get_shortcode_regex(); - preg_match( "/$pattern/s", get_the_content(), $match ); - $atts = shortcode_parse_atts( $match[3] ); - if ( isset( $atts['ids'] ) ) - $images = explode( ',', $atts['ids'] ); - } + $galleries = get_post_galleries( get_the_ID(), false ); + if ( isset( $galleries[0]['ids'] ) ) + $images = explode( ',', $galleries[0]['ids'] ); if ( ! $images ) : $images = get_posts( array( 'fields' => 'ids', - 'numberposts' => 999, + 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image', @@ -166,19 +158,17 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { if ( ! empty ( $post_thumbnail ) ) : ?> - - - + + + +