Making WordPress.org


Ignore:
Timestamp:
11/17/2017 01:31:00 PM (6 years ago)
Author:
obenland
Message:

Main: Bring back localized showcase teaser.

Also fixes line-breaking headlines in some locales.

H/t netveb.
See #2861.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/front-page.php

    r6137 r6142  
    1414
    1515namespace WordPressdotorg\MainTheme;
     16
     17global $rosetta;
     18
     19$showcase   = $rosetta->showcase->front();
     20$swag_class = $showcase ? 'col-4' : 'col-2';
     21$user_class = $showcase ? 'col-12' : 'col-2';
    1622
    1723get_header( 'wporg' );
     
    135141            </div>
    136142
    137             <div class="col-2 first">
     143            <div class="<?php echo esc_attr( $swag_class ); ?> first">
    138144                <h4><a href="https://wordpress.org/about/swag/"><?php _e( 'WordPress&nbsp;Swag', 'wporg' ); ?></a></h4>
    139                 <a href="https://wordpress.org/about/swag/"><img width="132" height="177" src="https://wpdotorg.files.wordpress.com/2015/10/gray-tshirt-swag.jpg" alt="<?php esc_attr_e( 'WordPress Swag', 'wporg' ); ?>" /></a>
    140             </div>
    141 
    142             <div class="col-2">
     145                <a href="https://wordpress.org/about/swag/">
     146                    <?php if ( $showcase ) : ?>
     147                        <img width="288" height="288" src="https://s.w.org/images/home/swag_col-2.png" srcset="https://s.w.org/images/home/swag_col-2_x2.jpg x2" alt="<?php esc_attr_e( 'WordPress Swag', 'wporg' ); ?>" />
     148                    <?php else : ?>
     149                        <img width="132" height="177" src="https://s.w.org/images/home/swag_col-1.jpg?1" alt="<?php esc_attr_e( 'WordPress Swag', 'wporg' ); ?>" />
     150                    <?php endif; ?>
     151                </a>
     152            </div>
     153
     154            <div class="<?php echo esc_attr( $user_class ); ?>">
    143155                <h4><a href="https://wordpress.org/showcase/"><?php _e( 'WordPress&nbsp;Users', 'wporg' ); ?></a></h4>
    144156
    145                 <ul id="notable-users" class="notable-users">
    146                     <?php
    147                         $links = array(
     157                <?php if ( $showcase ) : ?>
     158                    <div id="notable-users" class="notable-users col-12 row gutters">
     159                        <?php
     160                        foreach ( $showcase as $showcase_post ) :
     161                            $post_url  = get_permalink( $showcase_post->ID );
     162                            $thumbnail = has_post_thumbnail( $showcase_post->ID )
     163                                ? get_the_post_thumbnail( $showcase_post->ID, 'showcase-thumbnail' )
     164                                : sprintf( '<img src="%1$s" width="220" alt="%2$s" />', esc_url( $rosetta->screenshot_url( $post_url, 220 ) ), esc_attr( $showcase_post->post_title ) );
     165
     166                            printf(
     167                                '<div class="col-3"><a href="%1$s">%2$s</a></div>',
     168                                esc_url( $post_url ),
     169                                $thumbnail
     170                            );
     171                        endforeach;
     172                        ?>
     173                    </div>
     174                <?php else : ?>
     175                    <ul id="notable-users" class="notable-users">
     176                        <?php
     177                        $user_links = [
    148178                            'nytimes'       => 'https://wordpress.org/showcase/tag/new-york-times/',
    149179                            'cnn'           => 'https://wordpress.org/showcase/tag/cnn/',
     
    154184                            'blondie'       => 'https://wordpress.org/showcase/blondie/',
    155185                            'marthastewart' => 'https://wordpress.org/showcase/themarthablog/',
    156                         );
    157 
    158                         foreach ( array_rand( $links, 3 ) as $slug ) :
     186                        ];
     187
     188                        foreach ( array_rand( $user_links, 3 ) as $slug ) :
    159189                            printf(
    160190                                '<li><a href="%1$s"><img src="https://s.w.org/images/notableusers/%2$s-2x.png" alt="%2$s" width="130" height="57" /></a></li>',
    161                                 $links[ $slug ],
     191                                $user_links[ $slug ],
    162192                                $slug
    163193                            );
    164194                        endforeach;
    165                     ?>
    166                 </ul>
     195                        ?>
     196                    </ul>
     197                <?php endif; ?>
     198
    167199                <a class="showcase-link" href="https://wordpress.org/showcase/"><?php _e( '&hellip; and hundreds more', 'wporg' ); ?></a>
    168200            </div>
     
    171203    </main><!-- #main -->
    172204
    173 <?php
     205    <?php
    174206get_footer();
Note: See TracChangeset for help on using the changeset viewer.