WordPress.org

Making WordPress.org

Changeset 2092


Ignore:
Timestamp:
11/18/2015 10:54:00 PM (6 years ago)
Author:
iandunn
Message:

WordCamp Base: Add initial-scale=1 to viewport on new sites.

Fixes #1397
Props rclilly

Location:
sites/trunk/wordcamp.org/public_html/wp-content
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/helper-functions.php

    r1701 r2092  
    104104    return $name;
    105105}
     106
     107/**
     108 * Determine if a specific feature should be skipped on the current site
     109 *
     110 * Often times we want to add new functionality to plugins and themes, but can't let it run on older sites
     111 * because that would break backwards compatibility. To get around that, we set a flag on older sites to
     112 * indicate that they should not have the new feature, and then setup the feature to run on sites that
     113 * don't have the flag, i.e., to run by default.
     114 *
     115 * Doing it this way means that local development environments like the Meta Environment don't have add any
     116 * new filters in order to start using the new functionality.
     117 *
     118 * @param string $flag
     119 *
     120 * @return bool
     121 */
     122function wcorg_skip_feature( $flag ) {
     123    $flags = get_option( 'wordcamp_skip_features', array() );
     124
     125    return isset( $flags[ $flag ] );
     126}
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base-v2/header.php

    r622 r2092  
    1212<head>
    1313<meta charset="<?php bloginfo( 'charset' ); ?>" />
    14 <meta name="viewport" content="width=device-width" />
     14<meta name="viewport" content="<?php echo esc_attr( wcb_get_viewport() ); ?>" />
    1515<meta name="apple-mobile-web-app-capable" content="yes" />
    1616<title><?php
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base-v2/lib/utils/header.php

    r2 r2092  
    9393}
    9494
    95 ?>
     95/**
     96 * Get the value for the <meta name="viewport"> tag
     97 *
     98 * @return string
     99 */
     100function wcb_get_viewport() {
     101    $viewport = 'width=device-width';
     102
     103    if ( ! wcorg_skip_feature( 'wcb_viewport_initial_scale' ) ) {
     104        $viewport .= ', initial-scale=1';
     105    }
     106
     107    return $viewport;
     108}
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/header.php

    r412 r2092  
    99<head>
    1010<meta charset="<?php bloginfo( 'charset' ); ?>" />
    11 <meta name="viewport" content="width=device-width">
     11<meta name="viewport" content="<?php echo esc_attr( wcb_get_viewport() ); ?>">
    1212<?php wcb_title_tag(); ?>
    1313<link rel="profile" href="http://gmpg.org/xfn/11" />
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/utils/header.php

    r1662 r2092  
    9393}
    9494
    95 ?>
     95/**
     96 * Get the value for the <meta name="viewport"> tag
     97 *
     98 * @return string
     99 */
     100function wcb_get_viewport() {
     101    $viewport = 'width=device-width';
     102
     103    if ( ! wcorg_skip_feature( 'wcb_viewport_initial_scale' ) ) {
     104        $viewport .= ', initial-scale=1';
     105    }
     106
     107    return $viewport;
     108}
Note: See TracChangeset for help on using the changeset viewer.