WordPress.org

Plugin Directory

Changeset 611642


Ignore:
Timestamp:
10/12/12 18:58:13 (18 months ago)
Author:
cfinke
Message:

Mobile Theme: Adds an option to the Custom CSS page that allows the user to enable their custom CSS when the mobile theme is being shown.

The options aren't shown if the mobile theme has been disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/minileven/minileven.php

    r607582 r611642  
    181181        add_action('option_stylesheet', 'jetpack_mobile_stylesheet'); 
    182182 
    183         if ( function_exists( 'disable_safecss_style' ) ) 
     183        if ( function_exists( 'disable_safecss_style' ) && ! get_option( 'wp_mobile_custom_css' ) ) 
    184184            add_action( 'init', 'disable_safecss_style', 11 ); 
    185185 
     
    241241 
    242242add_action( 'wp_mobile_theme_footer', 'jetpack_mobile_app_promo' ); 
     243 
     244/** 
     245 * Adds an option to allow your Custom CSS to also be applied to the Mobile Theme. 
     246 * It's disabled by default, but this should allow people who know what they're 
     247 * doing to customize the mobile theme. 
     248 */ 
     249function jetpack_mobile_css_settings() { 
     250    ?> 
     251    <p> 
     252        <label> 
     253            <input type="checkbox" name="mobile_css" value="1" <?php checked( get_option( 'wp_mobile_custom_css' ) ); ?> /> 
     254            <?php esc_html_e( 'Apply this CSS to the Mobile Theme', 'jetpack' ); ?> 
     255        </label> 
     256    </p> 
     257    <?php 
     258} 
     259 
     260add_action( 'custom_css_meta_fields', 'jetpack_mobile_css_settings' ); 
     261 
     262function jetpack_mobile_save_css_settings() { 
     263    update_option( 'wp_mobile_custom_css', isset( $_POST['mobile_css'] ) && ! empty( $_POST['mobile_css'] ) ); 
     264} 
     265 
     266add_action( 'safecss_save_pre', 'jetpack_mobile_save_css_settings' ); 
Note: See TracChangeset for help on using the changeset viewer.