Make WordPress Core

Ticket #25144: 25144.1.diff

File 25144.1.diff, 29.8 KB (added by obenland, 12 years ago)
  • wp-content/themes/twentyfourteen/functions.php

     
    186186function twentyfourteen_font_url() {
    187187        $font_url = '';
    188188        /*
    189          * Translators: If there are characters in your language that are not supported
    190          * by Lato, translate this to 'off'. Do not translate into your own language.
     189         * Translators: If there are characters in your language that are not
     190         * supported by Lato, translate this to 'off'. Do not translate into your
     191         * own language.
    191192         */
    192193        if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) )
    193                 $font_url = add_query_arg( 'family', urlencode( 'Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' ), "//fonts.googleapis.com/css" );
     194                $font_url = add_query_arg( 'family', urlencode( 'Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' ), '//fonts.googleapis.com/css' );
    194195
    195196        return $font_url;
    196197}
     
    415416 */
    416417function twentyfourteen_pre_get_posts( $query ) {
    417418        // Bail if not home, not a query, not main query.
    418         if ( ! $query->is_main_query() || is_admin() )
     419        if ( ! $query->is_home() || ! $query->is_main_query() )
    419420                return;
    420421
    421         // Only on the home page
    422         if ( $query->is_home() ) {
    423                 $exclude_ids = array();
    424 
    425                 $videos = twentyfourteen_get_recent( 'post-format-video' );
    426                 $images = twentyfourteen_get_recent( 'post-format-image' );
    427                 $galleries = twentyfourteen_get_recent( 'post-format-gallery' );
    428                 $asides = twentyfourteen_get_recent( 'post-format-aside' );
    429                 $links = twentyfourteen_get_recent( 'post-format-link' );
    430                 $quotes = twentyfourteen_get_recent( 'post-format-quote' );
    431 
    432                 foreach ( $videos->posts as $post )
    433                         $exclude_ids[] = $post->ID;
    434 
    435                 foreach ( $images->posts as $post )
    436                         $exclude_ids[] = $post->ID;
    437 
    438                 foreach ( $galleries->posts as $post )
    439                         $exclude_ids[] = $post->ID;
    440 
    441                 foreach ( $asides->posts as $post )
    442                         $exclude_ids[] = $post->ID;
    443 
    444                 foreach ( $links->posts as $post )
    445                         $exclude_ids[] = $post->ID;
     422        $exclude_ids  = array();
     423        $post_formats = array(
     424                twentyfourteen_get_recent( 'post-format-video'   ),
     425                twentyfourteen_get_recent( 'post-format-image'   ),
     426                twentyfourteen_get_recent( 'post-format-gallery' ),
     427                twentyfourteen_get_recent( 'post-format-aside'   ),
     428                twentyfourteen_get_recent( 'post-format-link'    ),
     429                twentyfourteen_get_recent( 'post-format-quote'   ),
     430        );
    446431
    447                 foreach ( $quotes->posts as $post )
     432        foreach ( $post_formats as $formatted_posts ) {
     433                foreach ( $formatted_posts->posts as $post ) {
    448434                        $exclude_ids[] = $post->ID;
    449 
    450                 $query->set( 'post__not_in', $exclude_ids );
     435                }
    451436        }
     437
     438        $query->set( 'post__not_in', $exclude_ids );
    452439}
    453440add_action( 'pre_get_posts', 'twentyfourteen_pre_get_posts' );
    454441
     
    470457        if ( is_archive() || is_search() || is_home() )
    471458                $classes[] = 'list-view';
    472459
     460        if ( get_header_image() )
     461                $classes[] = 'header-image';
     462        else
     463                $classes[] = 'masthead-fixed';
     464
    473465        if ( ( ! is_front_page() && ! is_active_sidebar( 'sidebar-3' ) )
    474466                || is_page_template( 'full-width-page.php' )
    475467                || is_page_template( 'contributor-page.php' )
  • wp-content/themes/twentyfourteen/rtl.css

     
    120120        margin: 0 20px 0 0;
    121121}
    122122
    123 /* Mobile Navigations */
    124 .mobile-navigation ul ul li {
    125         margin-right: 15px;
    126         margin-left: auto;
    127 }
    128 
    129123
    130124/* =Content
    131125----------------------------------------------- */
     
    170164}
    171165
    172166.tag-links a:before {
    173         border-left: 10px solid #8c8c8c;
    174         right: -10px;
     167        border-left: 10px solid #767676;
     168        right: -9px;
    175169        left: auto;
    176170        border-right: none;
    177171}
     
    222216        margin-right: auto;
    223217}
    224218
    225 .post-navigation .nav-previous,
    226 .post-navigation .nav-next,
     219.post-navigation [rel="prev"],
     220.post-navigation [rel="next"],
    227221.image-navigation .previous-image,
    228222.image-navigation .next-image {
    229223        text-align: right;
     
    434428        .comment-respond,
    435429        .comments-area article,
    436430        .comment-list .trackback,
    437         .comment-list .pingback,
    438         .post-navigation [rel="prev"],
    439         .post-navigation [rel="next"] {
     431        .comment-list .pingback {
    440432                padding-left: 9.12778904%;
    441433                padding-right: 9.12778904%;
    442434        }
     
    497489        .comment-respond,
    498490        .comments-area article,
    499491        .comment-list li.trackback,
    500         .comment-list li.pingback,
    501         .post-navigation [rel="prev"],
    502         .post-navigation [rel="next"] {
     492        .comment-list li.pingback {
    503493                padding-left: 12.39493534%;
    504494                padding-right: 17.06896551%;
    505495        }
     
    619609        .comment-respond,
    620610        .comments-area article,
    621611        .comment-list .trackback,
    622         .comment-list .pingback,
    623         .post-navigation [rel="prev"],
    624         .post-navigation [rel="next"] {
     612        .comment-list .pingback {
    625613                padding-left: 9.87001616%;
    626614                padding-right: 9.19765166%;
    627615        }
     
    669657        }
    670658}
    671659
     660@media screen and (min-width: 1080px) {
     661        .search-box-wrapper,
     662        .featured-content {
     663                padding-left: auto;
     664                padding-right: 222px;
     665        }
     666        .site-content,
     667        .full-width .site-content {
     668                margin-left: auto;
     669                margin-right: 222px;
     670        }
     671        .secondary-navigation ul ul {
     672                left: auto;
     673                right: 168px;
     674        }
     675}
     676
    672677@media screen and (min-width: 1150px) {
    673678        .content-area .entry-header {
    674679                margin: -48px 12.5% 0 8.03571428%;
     
    688693        .comment-respond,
    689694        .comments-area article,
    690695        .comment-list .trackback,
    691         .comment-list .pingback,
    692         .post-navigation [rel="prev"],
    693         .post-navigation [rel="next"] {
     696        .comment-list .pingback {
    694697                padding-left: 12.44146986%;
    695698                padding-right: 16.77524429%;
    696699        }
     
    748751        }
    749752}
    750753
     754@media screen and (min-width: 1218px) {
     755        .content-area .entry-header,
     756        .content-area .entry-content,
     757        .content-area .entry-summary,
     758        .content-area footer.entry-meta,
     759        .archive-header,
     760        .page-header,
     761        .page-content,
     762        .post-navigation,
     763        .image-navigation,
     764        .comments-area {
     765                margin-left: 54px;
     766                margin-right: auto;
     767        }
     768        .full-width .content-area .entry-header,
     769        .full-width .content-area .entry-content,
     770        .full-width .content-area .entry-summary,
     771        .full-width .content-area footer.entry-meta,
     772        .full-width .archive-header,
     773        .full-width .page-header,
     774        .full-width .page-content,
     775        .full-width .post-navigation,
     776        .full-width .image-navigation,
     777        .full-width .comments-area {
     778                margin-left: auto;
     779        }
     780}
     781
    751782@media screen and (min-width: 1230px) {
    752783        .content-sidebar,
    753784        .post-formatted-posts {
     
    770801        .full-width .comment-list .pingback {
    771802                padding-left: 0;
    772803        }
    773 }
    774  No newline at end of file
     804}
  • wp-content/themes/twentyfourteen/inc/custom-header.php

     
    11<?php
    22/**
     3 * @todo: File description
     4 *
    35 * @package WordPress
    46 * @subpackage Twenty_Fourteen
    57 */
     
    79/**
    810 * Setup the WordPress core custom header feature.
    911 *
    10  * Use add_theme_support to register support for WordPress 3.4+
    11  * as well as provide backward compatibility for previous versions.
    12  * Use feature detection of wp_get_theme() which was introduced
    13  * in WordPress 3.4.
    14  *
    15  * @todo Rework this function to remove WordPress 3.4 support when WordPress 3.6 is released.
    16  *
    1712 * @uses twentyfourteen_header_style()
    1813 * @uses twentyfourteen_admin_header_style()
    1914 * @uses twentyfourteen_admin_header_image()
    2015 *
    21  * @package WordPress
    22  * @subpackage Twenty_Fourteen
     16 * @return void
    2317 */
    2418function twentyfourteen_custom_header_setup() {
    2519        add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array(
     
    116110 *
    117111 */
    118112function twentyfourteen_admin_header_image() {
    119         $header_image = get_header_image();
    120113?>
    121114        <div id="headimg">
    122                 <?php if ( ! empty( $header_image ) ) : ?>
     115                <?php if ( get_header_image() ) : ?>
    123116                <img src="<?php echo esc_url( $header_image ); ?>" alt="">
    124117                <?php endif; ?>
    125118                <h1 class="displaying-header-text"><a id="name"<?php echo sprintf( ' style="color:#%s;"', get_header_textcolor() ); ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
  • wp-content/themes/twentyfourteen/inc/customizer.php

     
    2323        $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'accent_color', array(
    2424                'label'    => __( 'Accent Color', 'twentyfourteen' ),
    2525                'section'  => 'colors',
    26                 'settings' => 'accent_color',
    2726        ) ) );
    2827}
    2928add_action( 'customize_register', 'twentyfourteen_customize_register' );
     
    4544function twentyfourteen_generate_accent_colors( $color ) {
    4645        $color = sanitize_hex_color( $color );
    4746
    48         set_theme_mod( 'accent_lighter', twentyfourteen_adjust_color( $color, 14 ) );
    49         set_theme_mod( 'accent_much_lighter', twentyfourteen_adjust_color( $color, 71 ) );
     47        set_theme_mod( 'accent_hover', twentyfourteen_adjust_color( $color, 14 ) );
     48        set_theme_mod( 'accent_active', twentyfourteen_adjust_color( $color, 71 ) );
    5049
    5150        return $color;
    5251}
     
    6463 */
    6564function twentyfourteen_adjust_color( $color, $steps ) {
    6665        // Convert shorthand to full hex.
    67         if ( strlen( $color ) == 3 ) {
    68                 $color = str_repeat( substr( $color, 1, 1 ), 2 ) . str_repeat( substr( $color, 2, 1 ), 2 ) . str_repeat( substr( $color, 3, 1), 2 );
    69         }
     66        if ( strlen( $color ) == 3 )
     67                $color = str_repeat( substr( $color, 1, 1 ), 2 ) . str_repeat( substr( $color, 2, 1 ), 2 ) . str_repeat( substr( $color, 3, 1 ), 2 );
    7068
    7169        // Convert hex to rgb.
    72         $rgb = array( hexdec( substr( $color, 1, 2 ) ), hexdec( substr( $color, 3, 2 ) ), hexdec( substr( $color, 5, 2 ) ) );
     70        $rgb = array(
     71                hexdec( substr( $color, 1, 2 ) ),
     72                hexdec( substr( $color, 3, 2 ) ),
     73                hexdec( substr( $color, 5, 2 ) ),
     74        );
    7375
    7476        // Adjust color and switch back to hex.
    7577        $hex = '#';
    76         foreach ( $rgb as $c ) {
    77                 $c += $steps;
    78                 if ( $c > 255 )
    79                         $c = 255;
    80                 elseif ( $c < 0 )
    81                         $c = 0;
    82                 $hex .= str_pad( dechex( $c ), 2, '0', STR_PAD_LEFT);
     78        foreach ( $rgb as $rgb_color ) {
     79                $rgb_color += $steps;
     80                if ( $rgb_color > 255 )
     81                        $rgb_color = 255;
     82                elseif ( $rgb_color < 0 )
     83                        $rgb_color = 0;
     84                $hex .= str_pad( dechex( $rgb_color ), 2, '0', STR_PAD_LEFT );
    8385        }
    8486
    8587        return $hex;
     
    8991 * Outputs the css for the Theme Customizer options.
    9092 */
    9193function twentyfourteen_customizer_styles() {
    92         $accent_color = get_theme_mod( 'accent_color' );
     94        $accent_color = get_theme_mod( 'accent_color', '#24890d' );
    9395
    9496        // Don't do anything if the current color is the default.
    9597        if ( '#24890d' === $accent_color )
    9698                return;
    9799
    98         $accent_lighter = get_theme_mod( 'accent_lighter' );
    99         $accent_much_lighter = get_theme_mod( 'accent_much_lighter' );
     100        $accent_hover  = get_theme_mod( 'accent_hover' );
     101        if ( ! $accent_hover ) {
     102                $accent_hover = twentyfourteen_adjust_color( $accent_color, 14 );
     103                set_theme_mod( 'accent_hover', $accent_hover );
     104        }
     105
     106        $accent_active = get_theme_mod( 'accent_active' );
     107        if ( ! $accent_active ){
     108                $accent_active = twentyfourteen_adjust_color( $accent_color, 71 );
     109                set_theme_mod( 'accent_active', $accent_active );
     110        }
    100111
    101         $css = '<style type="text/css" id="twentyfourteen-accent-color">
     112        $css = '
    102113                /* Custom accent color. */
    103114                h1 a:hover,
    104115                h2 a:hover,
     
    120131                        color: ' . $accent_color . ';
    121132                }
    122133
     134                @media screen and (min-width: 770px) {
     135                        .primary-navigation ul ul a:hover {
     136                                color: ' . $accent_color . ';
     137                        }
     138                }
     139
    123140                button:hover,
    124141                html input[type="button"]:hover,
    125142                input[type="reset"]:hover,
     
    158175
    159176                .page-links a:hover,
    160177                .paging-navigation .page-numbers.current {
    161                         border-color: ' .  $accent_color . ';
     178                        border-color: ' . $accent_color . ';
    162179                }
    163180
    164181                /* Generated variant of custom accent color: slightly lighter. */
     
    178195                .widget-area input[type="reset"]:active,
    179196                .widget-area input[type="submit"]:active,
    180197                .widget_calendar a:hover {
    181                         background-color: ' . $accent_lighter . ';
     198                        background-color: ' . $accent_hover . ';
    182199                }
    183200
    184201                /* Generated variant of custom accent color: much lighter. */
     
    190207                .content-sidebar html input[type="button"]:active,
    191208                .content-sidebar input[type="reset"]:active,
    192209                .content-sidebar input[type="submit"]:active {
    193                         background-color: ' . $accent_much_lighter . ';
     210                        background-color: ' . $accent_active . ';
    194211                }
    195212
    196213                a:hover,
     
    205222                #featured-content .entry-title a:hover,
    206223                #featured-content .more-link,
    207224                .widget-area a:hover {
    208                         color: ' . $accent_much_lighter . ';
    209                 }
    210                 </style>';
     225                        color: ' . $accent_active . ';
     226                }';
    211227
    212228        wp_add_inline_style( 'twentyfourteen-style', $css );
    213229}
  • wp-content/themes/twentyfourteen/inc/template-tags.php

     
    3232        $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
    3333
    3434        $links   = paginate_links( array(
    35                 'base'     => $pagenum_link,
    36                 'format'   => $format,
    37                 'total'    => $GLOBALS['wp_query']->max_num_pages,
    38                 'current'  => $paged,
    39                 'mid_size' => 1,
    40                 'add_args' => array_map( 'urlencode', $query_args ),
     35                'base'      => $pagenum_link,
     36                'format'    => $format,
     37                'total'     => $GLOBALS['wp_query']->max_num_pages,
     38                'current'   => $paged,
     39                'mid_size'  => 1,
     40                'add_args'  => array_map( 'urlencode', $query_args ),
    4141                'prev_text' => __( '&larr; Previous', 'twentyfourteen' ),
    4242                'next_text' => __( 'Next &rarr;', 'twentyfourteen' ),
    4343        ) );
  • wp-content/themes/twentyfourteen/header.php

     
    88 * @subpackage Twenty_Fourteen
    99 */
    1010?><!DOCTYPE html>
    11 <html <?php language_attributes(); ?> class="no-js">
     11<html <?php language_attributes(); ?>>
    1212<head>
    1313<meta charset="<?php bloginfo( 'charset' ); ?>" />
    1414<meta name="viewport" content="width=device-width" />
     
    3434        </div>
    3535        <?php endif; ?>
    3636
    37         <header id="masthead" class="site-header" role="banner">
     37        <header id="masthead" class="site-header masthead-fixed" role="banner">
    3838                <div class="header-main">
    3939                        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    4040
     
    4444                                </div>
    4545                        </div>
    4646
    47                         <nav role="navigation" class="site-navigation primary-navigation">
    48                                 <h1 class="screen-reader-text"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></h1>
    49                                 <div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyfourteen' ); ?>"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a></div>
    50                                 <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
     47                        <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
     48                                <h1 class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></h1>
     49                                <a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyfourteen' ); ?>"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
     50                                <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
    5151                        </nav>
    5252                </div>
    5353
    54                 <div id="mobile-navigations" class="hide"></div>
    55 
    5654                <div id="search-container" class="search-box-wrapper hide">
    5755                        <div class="search-box clear">
    5856                                <?php get_search_form(); ?>
  • wp-content/themes/twentyfourteen/style.css

     
    295295        font-size: 12px;
    296296        font-weight: 700;
    297297        line-height: 1;
    298         padding: 13px 33px 11px;
     298        padding: 12px 33px 10px;
    299299        text-transform: uppercase;
    300300        vertical-align: top;
    301301}
     
    468468}
    469469
    470470/* Genericons */
     471.menu-toggle:before,
    471472.search-toggle:before,
    472473.contributor-posts-link:before,
    473474.widget_twentyfourteen_ephemera .widget-title:before {
     
    541542        width: 100%;
    542543        z-index: 3;
    543544}
    544 
    545 /* Fixed Header */
    546 .site-header.masthead-fixed {
    547         box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
    548         position: fixed;
    549                 top: 0;
    550 }
    551 .admin-bar .site-header.masthead-fixed {
    552         top: 28px;
    553 }
    554 .admin-bar.mp6 .site-header.masthead-fixed {
    555         top: 32px;
    556 }
    557545#site-header {
    558546        position: relative;
    559547        z-index: 3;
     
    578566.site-title a {
    579567        color: #fff;
    580568}
    581 #nav-toggle {
     569.menu-toggle {
    582570        background-color: #000;
     571        font-size: 0;
     572        height: 16px;
     573        margin: 0;
    583574        padding: 16px;
    584575        position: absolute;
    585576                top:0;
    586577                right: 0;
    587         line-height: 1;
    588578}
    589 #nav-toggle:before {
     579.menu-toggle:before {
    590580        content: '\F419';
    591581        color: #fff;
    592582}
    593 #nav-toggle:hover {
     583.menu-toggle:hover {
    594584        cursor: pointer;
    595585}
    596586.search-toggle {
     
    651641/* =Menu
    652642----------------------------------------------- */
    653643
    654 /* Primary Navigation */
     644/* Primary Navigations */
    655645.primary-navigation {
    656         display: none;
    657         float: right;
    658         font-size: 11px;
    659         font-weight: 700;
    660         line-height: 1.6363636363;
    661         margin: 0 10px 0 -10px;
    662         text-transform: uppercase;
    663 }
    664 .primary-navigation ul {
    665         list-style: none;
    666         margin: 0;
    667         padding-left: 0;
    668 }
    669 .primary-navigation li {
     646        background-color: #000;
    670647        -webkit-box-sizing: border-box;
    671648        -moz-box-sizing:    border-box;
    672649        box-sizing:         border-box;
    673         display: inline-block;
    674         height: 48px;
    675         line-height: 48px;
    676         position: relative;
     650        font-size: 14px;
     651        font-weight: 700;
     652        margin: 1px auto 0;
     653        max-width: 474px;
     654        padding: 24px 10px 0;
     655        text-transform: uppercase;
    677656}
    678 .primary-navigation a {
    679         color: #fff;
    680         display: inline-block;
    681         padding: 0 10px;
    682         text-decoration: none;
    683         white-space: nowrap;
     657.primary-navigation.toggled-on {
     658        padding-top: 72px;
    684659}
    685 .primary-navigation ul ul {
    686         background-color: rgba(0, 0, 0, 0.9);
     660.primary-navigation .nav-menu {
    687661        display: none;
    688         float: left;
    689         position: absolute;
    690                 top: 48px;
    691                 left: 0;
    692         z-index: 99999;
    693662}
    694 .primary-navigation li li {
     663.primary-navigation.toggled-on .nav-menu {
    695664        display: block;
    696         height: auto;
    697         line-height: 1.6363636363;
    698665}
    699 .primary-navigation ul ul ul {
    700         left: 100%;
    701         top: 0;
     666.primary-navigation ul {
     667        list-style: none;
     668        margin: 0;
    702669}
    703 .primary-navigation ul ul a {
    704         padding: 9px 12px;
    705         width: 148px;
    706         white-space: normal;
     670.primary-navigation li {
     671        border-top: 1px solid rgba(255, 255, 255, 0.4);
    707672}
    708 .primary-navigation ul ul li {
     673.primary-navigation li li {
     674        border-top: 1px solid rgba(255, 255, 255, 0.2);
    709675}
    710 .primary-navigation li:hover > a {
    711         background-color: #2b2b2b;
    712         color: #fff;
     676.primary-navigation ul ul li {
     677        margin-left: 15px;
    713678}
    714 .primary-navigation ul li:hover > ul {
     679.primary-navigation a {
     680        color: rgba(255, 255, 255, 1);
    715681        display: block;
     682        padding: 7px 0 7px;
     683        text-decoration: none;
    716684}
    717 .primary-navigation li.current_page_item > a,
    718 .primary-navigation li.current-menu-item > a {
    719         color: #5FF23D;
     685.primary-navigation a:hover {
     686        color: rgba(255, 255, 255, 0.7);
    720687}
    721688
    722689/* Secondary Navigation */
     
    754721        color: #5FF23D;
    755722}
    756723
    757 /* Mobile Navigations */
    758 #mobile-navigations {
    759         margin: 1px auto 0;
    760         max-width: 474px;
    761 }
    762 .mobile-navigation {
    763         background-color: #000;
    764         -webkit-box-sizing: border-box;
    765         -moz-box-sizing:    border-box;
    766         box-sizing:         border-box;
    767         font-size: 14px;
    768         font-weight: 700;
    769         padding: 24px 10px 0;
    770         text-transform: uppercase;
    771 }
    772 .mobile-navigation ul {
    773         list-style: none;
    774         margin: 0;
    775 }
    776 .mobile-navigation li {
    777         border-top: 1px solid rgba(255, 255, 255, 0.4);
    778 }
    779 .mobile-navigation li li {
    780         border-top: 1px solid rgba(255, 255, 255, 0.2);
    781 }
    782 .mobile-navigation ul ul li {
    783         margin-left: 15px;
    784 }
    785 .mobile-navigation a {
    786         color: rgba(255, 255, 255, 1);
    787         display: block;
    788         padding: 7px 0 7px;
    789         text-decoration: none;
    790 }
    791 .mobile-navigation a:hover {
    792         color: rgba(255, 255, 255, 0.7);
    793 }
    794 
    795724
    796725/* =Content
    797726----------------------------------------------- */
     
    10991028        font-weight: 700;
    11001029        line-height: 1.2727272727;
    11011030        margin: 0 4px 4px 10px;
    1102         padding: 3px 7px;
     1031        padding: 4px 7px 2px;
    11031032        position: relative;
    11041033        text-transform: uppercase;
    11051034}
     
    19271856.widget_calendar a:hover {
    19281857        background-color: #35921f;
    19291858}
     1859#prev a,
     1860#next a {
     1861        background-color: transparent;
     1862}
     1863
    19301864.widget-area .widget_calendar a:hover {
    19311865        color: #fff; /* Override custom accent color with more specific selector. */
    19321866}
     
    23842318        .header-main {
    23852319                margin-right: 0;
    23862320        }
     2321
     2322        /* Fixed Header */
     2323        .masthead-fixed .site-header {
     2324                box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
     2325                position: fixed;
     2326                        top: 0;
     2327        }
     2328        .admin-bar.masthead-fixed .site-header {
     2329                top: 28px;
     2330        }
     2331        .admin-bar.mp6.masthead-fixed .site-header {
     2332                top: 32px;
     2333        }
     2334        .masthead-fixed .site-main {
     2335                margin-top: 48px;
     2336        }
     2337
     2338        /* Primary Navigation */
    23872339        .primary-navigation {
     2340                float: right;
     2341                font-size: 11px;
     2342                font-weight: 700;
     2343                line-height: 1.6363636363;
     2344                margin: 0 10px 0 -10px;
     2345                padding: 0;
     2346                text-transform: uppercase;
     2347        }
     2348        .primary-navigation .menu-toggle {
     2349                display: none;
     2350                padding: 0;
     2351        }
     2352        .primary-navigation .nav-menu {
    23882353                display: block;
    23892354        }
     2355        .primary-navigation.toggled-on {
     2356                padding: 0;
     2357        }
     2358        .primary-navigation li {
     2359                border: 0;
     2360                -webkit-box-sizing: border-box;
     2361                -moz-box-sizing:    border-box;
     2362                box-sizing:         border-box;
     2363                display: inline-block;
     2364                height: 48px;
     2365                line-height: 48px;
     2366                position: relative;
     2367        }
     2368        .primary-navigation a {
     2369                display: inline-block;
     2370                padding: 0 10px;
     2371                white-space: nowrap;
     2372        }
     2373        .primary-navigation ul ul {
     2374                background-color: rgba(0, 0, 0, 0.9);
     2375                display: none;
     2376                float: left;
     2377                position: absolute;
     2378                        top: 48px;
     2379                        left: 0;
     2380                z-index: 99999;
     2381        }
     2382        .primary-navigation li li {
     2383                border: 0;
     2384                display: block;
     2385                height: auto;
     2386                line-height: 1.6363636363;
     2387        }
     2388        .primary-navigation ul ul ul {
     2389                left: 100%;
     2390                top: 0;
     2391        }
     2392        .primary-navigation ul ul a {
     2393                padding: 9px 12px;
     2394                width: 148px;
     2395                white-space: normal;
     2396        }
     2397        .primary-navigation ul ul li {
     2398                margin: 0;
     2399        }
     2400        .primary-navigation li:hover > a {
     2401                background-color: #2b2b2b;
     2402                color: #fff;
     2403        }
     2404        .primary-navigation li li:hover > a {
     2405                background-color: #000;
     2406        }
     2407        .primary-navigation ul ul a:hover {
     2408                color: #24890d;
     2409        }
     2410        .primary-navigation ul li:hover > ul {
     2411                display: block;
     2412        }
     2413        .primary-navigation li.current_page_item > a,
     2414        .primary-navigation li.current-menu-item > a {
     2415                color: #5FF23D;
     2416        }
    23902417}
    23912418
    23922419@media screen and (min-width: 810px) {
  • wp-content/themes/twentyfourteen/js/customizer.js

     
    1616                        $( '.site-description' ).text( to );
    1717                } );
    1818        } );
    19 } )( jQuery );
    20  No newline at end of file
     19} )( jQuery );
  • wp-content/themes/twentyfourteen/js/theme.js

     
     1/**
     2 * Functionality specific to Twenty Fourteen.
     3 *
     4 * Provides helper functions to enhance the theme experience.
     5 */
     6
    17( function( $ ) {
     8        var body    = $( 'body' ),
     9            _window = $( window );
    210
    3         $( document ).ready( function() {
     11        /**
     12         * Enables menu toggle for small screens.
     13         */
     14        ( function() {
     15                var nav = $( '#primary-navigation' ), button, menu;
     16                if ( ! nav )
     17                        return;
    418
    5                 var $primaryNaviClone,
    6                         $secondaryNaviClone,
    7                         $masthead = $( '#masthead' ),
    8                         $secondaryTop = $( '#secondary-top' ),
    9                         $mobileNavigations = $( '#mobile-navigations'),
    10                         $searchBoxWrapper = $( 'div.search-box-wrapper' ),
    11                         $searchToggle = $( 'div.search-toggle' ),
    12                         timeout = false;
     19                button = nav.find( '.menu-toggle' );
     20                if ( ! button )
     21                        return;
    1322
    14                 // Toggle function.
    15                 function menuToggle() {
    16                         $( 'span#nav-toggle' ).toggleClass( 'active' );
    17                         $masthead.find( '#mobile-navigations' ).toggleClass( 'hide' );
     23                // Hide button if menu is missing or empty.
     24                menu = nav.find( '.nav-menu' );
     25                if ( ! menu || ! menu.children().length ) {
     26                        button.hide();
     27                        return;
    1828                }
    1929
    20                 // Click event for toggle the search
    21                 $searchToggle.click( function() {
    22                         $( this ).toggleClass( 'active' );
    23                         $searchBoxWrapper.toggleClass( 'hide' );
    24 
    25                         if ( $( this ).hasClass( 'active' ) )
    26                                 $searchBoxWrapper.find( '.search-field' ).focus();
     30                $( '.menu-toggle' ).on( 'click.twentyfourteen', function() {
     31                        nav.toggleClass( 'toggled-on' );
    2732                } );
    28 
    29                 // DOM manipulations for mobile header
    30                 function mobileHeader() {
    31                         // Check if the toggler exists. If not add it.
    32                         if ( ! $( '#nav-toggle' ).length )
    33                         $( '<span id="nav-toggle" class="genericon" />' ).appendTo( $masthead );
    34 
    35                         // Clone and detach the primary navigation for use later
    36                         $primaryNaviClone = $masthead.find( 'nav.primary-navigation' ).detach();
    37 
    38                         // Clone and detach the secondary navigation for use later
    39                         $secondaryNaviClone = $secondaryTop.find( 'nav.secondary-navigation' ).detach();
    40 
    41                         // Prepend the primary navigation clone to #mobile-navigations and remove the class and add an id
    42                         $primaryNaviClone.prependTo( $mobileNavigations ).removeClass( 'primary-navigation' ).addClass( 'mobile-navigation' ).attr( 'id', 'primary-mobile-navigation' );
    43 
    44                         // Append the secondary navigation clone to #mobile-navigations and remove the class and add an id
    45                         $secondaryNaviClone.appendTo( $mobileNavigations ).removeClass( 'secondary-navigation' ).addClass( 'mobile-navigation' ).attr( 'id', 'secondary-mobile-navigation' );
    46 
    47                         // Remove the click event first and bind it after to make sure it's invoked once.
    48                         $( 'span#nav-toggle' ).off( 'click', menuToggle ).click( menuToggle );
    49                 };
    50 
    51                 // DOM manupilations for desktop header
    52                 function normalHeader() {
    53                         // Check if the toggler exists. If it does remove it.
    54                         if ( $( 'span#nav-toggle').length )
    55                         $( 'span#nav-toggle' ).remove();
    56 
    57                         // Clone and detach the primary mobile navigation for use later
    58                         $primaryNaviClone = $mobileNavigations.find( '#primary-mobile-navigation' ).detach();
     33        } )();
    5934
    60                         // Clone and detach the secondary mobile navigation for use later
    61                         $secondaryNaviClone = $mobileNavigations.find( '#secondary-mobile-navigation' ).detach();
     35        $( function() {
     36                /**
     37                 * Search toggle.
     38                 */
     39                $( '.search-toggle' ).on( 'click.twentyfourteen', function() {
     40                        var that    = $( this ),
     41                            wrapper = $( '.search-box-wrapper' );
    6242
    63                         // Append the secondary navigation clone to #mobile-navigations and remove the class and add an id
    64                         $primaryNaviClone.appendTo( '.header-main' ).removeClass( 'mobile-navigation' ).removeAttr( 'id' ).addClass( 'primary-navigation' );
     43                        that.toggleClass( 'active' );
     44                        wrapper.toggleClass( 'hide' );
    6545
    66                         // Append the secondary navigation clone to #mobile-navigations and remove the class and add an id
    67                         $secondaryNaviClone.appendTo( $secondaryTop ).removeClass( 'mobile-navigation' ).removeAttr( 'id' ).addClass( 'secondary-navigation' );
    68                 };
    69 
    70                 // Check viewport width when user resizes the browser window.
    71                 $( window ).resize( function() {
    72                         if ( false !== timeout )
    73                                 clearTimeout( timeout );
    74 
    75                         timeout = setTimeout( function() {
    76                                 if ( $( window ).width() < 770 ) {
    77                                         mobileHeader();
    78                                 } else {
    79                                         normalHeader();
    80                                 }
    81                         }, 100 );
    82 
    83                 } ).resize();
    84 
    85                 // Sticky header.
    86                 var $mastheadOffset  = -1,
    87                         $toolbarOffset = $( 'body' ).is( '.admin-bar' ) ? 32 : 0,
    88                         $maindiv = $( '#main' );
    89 
    90                 $( window ).on( 'scroll', false, function() {
    91                         if ( $mastheadOffset < 0 )
    92                                 $mastheadOffset = $masthead.offset().top - $toolbarOffset;
    93 
    94                         if ( ( window.scrollY > $mastheadOffset ) && ( $( window ).width() > 769 ) ) {
    95                                 $masthead.addClass( 'masthead-fixed' );
    96                                 $maindiv.css( {
    97                                         marginTop: $masthead.height()
    98                                 } );
    99                         } else {
    100                                 $masthead.removeClass( 'masthead-fixed' );
    101                                 $maindiv.css( {
    102                                         marginTop: 0
    103                                 } );
    104                         }
     46                        if ( that.is( '.active' ) )
     47                                wrapper.find( '.search-field' ).focus();
    10548                } );
    10649
    107                 // Arranges footer widgets vertically.
    108                 if ( $.isFunction( $.fn.masonry ) ) {
    109 
    110                         $( '#footer-sidebar' ).masonry( {
    111                                 itemSelector: '.widget',
    112                                 columnWidth: 225,
    113                                 gutterWidth: 27,
    114                                 isRTL: $( 'body' ).is( '.rtl' )
     50                /**
     51                 * Fixed navbar.
     52                 */
     53                if ( body.is( '.header-image' ) && _window.width() > 769 ) {
     54                        var toolbarOffset  = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0,
     55                            mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
     56       
     57                        _window.on( 'scroll.twentyfourteen', false, function() {
     58                                if ( window.scrollY > mastheadOffset )
     59                                        body.addClass( 'masthead-fixed' );
     60                                else
     61                                        body.removeClass( 'masthead-fixed' );
    11562                        } );
    11663                }
    117 
    11864        } );
    11965
    120 } )( jQuery );
    121  No newline at end of file
     66        /**
     67         * Makes "skip to content" link work correctly in IE9 and Chrome for better
     68         * accessibility.
     69         *
     70         * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
     71         */
     72        _window.on( 'hashchange.twentyfourteen', function() {
     73                var element = document.getElementById( location.hash.substring( 1 ) );
     74
     75                if ( element ) {
     76                        if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) )
     77                                element.tabIndex = -1;
     78
     79                        element.focus();
     80                }
     81        } );
     82       
     83        /**
     84         * Arranges footer widgets vertically.
     85         */
     86        if ( $.isFunction( $.fn.masonry ) ) {
     87                $( '#footer-sidebar' ).masonry( {
     88                        itemSelector: '.widget',
     89                        columnWidth: 225,
     90                        gutterWidth: 27,
     91                        isRTL: body.is( '.rtl' )
     92                } );
     93        }
     94} )( jQuery );