Making WordPress.org

Changeset 393


Ignore:
Timestamp:
02/11/2014 08:07:16 PM (12 years ago)
Author:
iandunn
Message:

Coming Soon Page: Ensure consistent styles regardless of current theme.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/TODO.txt

    r390 r393  
    11High priority:
    2     make work consistently with any theme
    32    refactor get_contact_form_shortcode() once https://github.com/Automattic/jetpack/issues/102 is fixed
    43        if doesn't happen soon, then add admin notice if missing page w/ contact form or it's not published
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wordcamp-coming-soon-page.php

    r391 r393  
    3232        }
    3333       
    34         // todo maybe need to exempt jetpack styles also - $exempt_stylesheets = array(  );
    35         if ( $this->override_theme_template ) {
    36             foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) {
    37                 // todo removing fonts that we want - wp_dequeue_style( $stylesheet );
    38             }
    39         }
    40 
    41         $twenty_thirteen_stylesheet = '/twentythirteen/style.css';
    42         foreach( $GLOBALS['wp_theme_directories'] as $directory ) {
    43             if ( is_file( $directory . $twenty_thirteen_stylesheet ) ) {
    44                 wp_register_style( 'twentythirteen-style-css', $directory . $twenty_thirteen_stylesheet );
    45                 wp_register_style( 'twentythirteen-fonts-css', '//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&subset=latin%2Clatin-ext' );
    46                
    47                 // todo still isn't consistent between local and remote sandboxes
    48             }
    49         }
    50        
    51         wp_register_style(
     34        $this->dequeue_all_stylesheets();
     35        $this->register_twentythirteen_styles();
     36
     37        wp_enqueue_style(
    5238            'wccsp-template',
    5339            plugins_url( '/css/template-coming-soon.css', __DIR__ ),
    54             array( 'twentythirteen-style-css', 'twentythirteen-fonts-css' ),
     40            array( 'twentythirteen-fonts', 'genericons', 'twentythirteen-style' ),
    5541            self::VERSION
    5642        );
    57        
    58         wp_enqueue_style( 'wccsp-template' );
     43    }
     44
     45    /**
     46     * Dequeue all enqueued stylesheets
     47     */
     48    protected function dequeue_all_stylesheets() {
     49        foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) {
     50            wp_dequeue_style( $stylesheet );
     51        }
     52    }
     53
     54    /**
     55     * Register TwentyThirteen's base styles
     56     */
     57    protected function register_twentythirteen_styles() {
     58        $twentythirteen_uri = get_theme_root_uri( 'twentythirteen' ) . '/twentythirteen';
     59       
     60        if ( ! wp_style_is( 'twentythirteen-fonts', 'registered' ) ) {
     61            wp_register_style( 'twentythirteen-fonts', '//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&subset=latin%2Clatin-ext', array(), null );
     62        }
     63
     64        if ( ! wp_style_is( 'genericons', 'registered' ) ) {
     65            wp_register_style( 'genericons', $twentythirteen_uri . '/fonts/genericons.css' );
     66        }
     67
     68        if ( ! wp_style_is( 'twentythirteen-style', 'registered' ) ) {
     69            wp_register_style( 'twentythirteen-style', $twentythirteen_uri . '/style.css' );
     70        }
    5971    }
    6072
Note: See TracChangeset for help on using the changeset viewer.