Making WordPress.org

Changeset 1527


Ignore:
Timestamp:
04/30/2015 11:31:29 PM (9 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Prevent brief display of search bar on page load before it gets hidden (while maintaining no-JS support). Fixes #763.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php

    r1505 r1527  
    8787    add_action( 'pre_get_posts', __NAMESPACE__ . '\\pre_get_posts' );
    8888    add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\theme_scripts_styles' );
     89    add_action( 'wp_head', __NAMESPACE__ . '\\header_js' );
    8990    add_action( 'add_meta_boxes', __NAMESPACE__ . '\\rename_comments_meta_box', 10, 2 );
    9091
     
    103104    add_filter( 'breadcrumb_trail_items',  __NAMESPACE__ . '\\breadcrumb_trail_items', 10, 2 );
    104105
    105     add_filter( 'wp_parser_skip_duplicate_hooks', '__return_true' ); 
     106    add_filter( 'wp_parser_skip_duplicate_hooks', '__return_true' );
    106107
    107108}
     
    244245}
    245246
     247/**
     248 * Outputs JavaScript intended to appear in the head of the page.
     249 */
     250function header_js() {
     251    // Output CSS to hide markup with the class 'hide-if-js'. Ensures the markup is visible if JS is not present.
     252    echo "<script type=\"text/javascript\">jQuery( '<style>.hide-if-js { display: none; }</style>' ).appendTo( 'head' );</script>\n";
     253}
     254
    246255function theme_scripts_styles() {
    247256    wp_enqueue_style( 'dashicons' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/search.js

    r1492 r1527  
    1515        }
    1616    }
    17 
    18     // Toggle search bar on page load (it's shown by default).
    19     toggle_search_bar();
    2017
    2118    // Toggle search bar when icon is clicked.
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php

    r1327 r1527  
    66 */
    77?>
    8 <div class="search-section section clear">
     8<div class="search-section section clear <?php if ( ! is_page( 'reference' ) ) { echo 'hide-if-js'; } ?>">
    99
    1010<?php if ( is_search() ) { ?>
Note: See TracChangeset for help on using the changeset viewer.