WordPress.org

Making WordPress.org


Ignore:
Timestamp:
09/06/2017 05:44:00 PM (2 years ago)
Author:
obenland
Message:

WPorg/Main: Pull teaser post from blog.

Also fixes to visual bugs where the pointer to the current menu item had the
wrong color and the divider to home below didn't show up.

See #2861.

File:
1 edited

Legend:

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

    r5879 r5891  
    1313 */
    1414
    15 namespace WordPressdotorg\Theme;
    16 function get_latest_devblog_post() {
    17     $cached = wp_cache_get('feed', 'wporg');
    18     if (is_array($cached)) {
    19         echo '<!-- feed is cached -->';
    20         return $cached;
    21     }
    22     $feed = file_get_contents('http://wordpress.org/news/feed/');
    23     preg_match('|<item>\s*<title>(.*?)</title>.*?<link>(.*?)</link>.*?<description><!\[CDATA\[(.*?)\]\]>|s', $feed, $matches);
    24     $matches = array_map('trim', $matches);
    25     $matches[3] = preg_replace('|\s*\[\.\.\.\]$|', '&hellip;', $matches[3]);
    26     $latest_post = array('title' => $matches[1], 'link' => $matches[2], 'content' => $matches[3]);
    27     wp_cache_set('feed', $latest_post, 'wporg', 3600);
    28     return $latest_post;
    29 }
    30 
    31 $latest_post = [];//get_latest_devblog_post();
    32 
    33 $headadd = '<link rel="alternate" type="application/rss+xml" title="WordPress Blog RSS" href="http://wordpress.org/news/feed/" />';
    34 $pagetitle = 'Blog Tool, Publishing Platform, and CMS';
    35 $titleover = 'Welcome to WordPress';
     15namespace WordPressdotorg\MainTheme;
    3616
    3717require WPORGPATH . 'header.php';
    38  ?>
     18?>
    3919    <header id="masthead" class="site-header" role="banner">
    4020        <div class="site-branding">
     
    4525    </header><!-- #masthead -->
    4626
    47     <main id="main" class="site-main home-welcome" role="main">
    48         <div id="lang-guess-wrap"></div>
     27    <main id="main" class="site-main " role="main">
     28        <div class="home-welcome">
     29            <div id="lang-guess-wrap"></div>
    4930
    50         <section class="intro">
    51             <p class="subheading"><?php _e( 'Beautiful designs, powerful features, and the freedom to build anything you want. WordPress is both free and priceless at the same time.' ); ?></p>
    52             <div class="screenshots">
    53                 <img src="https://s.w.org/images/home/screen-themes.png?1" class="dashboard" />
    54                 <img src="https://s.w.org/images/home/iphone-themes.png?1" class="dashboard-mobile" />
     31            <section class="intro">
     32                <p class="subheading"><?php _e( 'Beautiful designs, powerful features, and the freedom to build anything you want. WordPress is both free and priceless at the same time.' ); ?></p>
     33                <div class="screenshots">
     34                    <img src="https://s.w.org/images/home/screen-themes.png?1" class="dashboard" />
     35                    <img src="https://s.w.org/images/home/iphone-themes.png?1" class="dashboard-mobile" />
     36                </div>
     37            </section>
     38
     39            <section class="showcase">
     40                <h2><?php _e( 'Trusted by the Best' ); ?></h2>
     41                <p class="subheading"><?php _e( '28% of the web uses WordPress, from hobby blogs to the biggest news sites online.' ); ?></p>
     42                <div class="collage">
     43
     44                </div>
     45                <p class="cta-link"><a href="https://wordpress.org/showcase/"><?php _e( 'Discover more sites built with WordPress' ); ?></a>.</p>
     46            </section>
     47
     48            <section class="features">
     49                <h2><?php _e( 'Powerful Features' ); ?></h2>
     50                <p class="subheading"><?php _e( 'Limitless possibilities. What will you create?' ); ?></p>
     51                <ul>
     52                    <li>
     53                        <span class="dashicons dashicons-admin-customizer"></span>
     54                        <?php _e( 'Customizable<br />Designs' ); ?>
     55                    </li>
     56                    <li>
     57                        <span class="dashicons dashicons-welcome-widgets-menus"></span>
     58                        <?php _e( 'SEO<br />Friendly' ); ?>
     59                    </li>
     60                    <li>
     61                        <span class="dashicons dashicons-smartphone"></span>
     62                        <?php _e( 'Responsive<br />Mobile Sites' ); ?>
     63                    </li>
     64                    <li>
     65                        <span class="dashicons dashicons-chart-line"></span>
     66                        <?php _e( 'High<br />Performance' ); ?>
     67                    </li>
     68                    <li>
     69                        <a href="https://wordpress.org/mobile/"><img src="https://s.w.org/images/home/icon-run-blue.svg" />
     70                            <?php _e( 'Manage<br />on the Go' ); ?></a>
     71                    </li>
     72                    <li>
     73                        <span class="dashicons dashicons-lock"></span>
     74                        <?php _e( 'High<br />Security' ); ?>
     75                    </li>
     76                    <li>
     77                        <span class="dashicons dashicons-images-alt2"></span>
     78                        <?php _e( 'Powerful<br />Media Management' ); ?>
     79                    </li>
     80                    <li>
     81                        <span class="dashicons dashicons-universal-access"></span>
     82                        <?php _e( 'Easy and<br />Accessible' ); ?>
     83                    </li>
     84                </ul>
     85                <p><?php
     86                    /* translators: %s: Link to Plugin Directory. */
     87                    printf( __( 'Extend WordPress with over 45,000 plugins to help your website meet your needs. Add an online store, galleries, mailing lists, forums, analytics, and <a href="%s">much more</a>.' ), esc_url( 'https://wordpress.org/plugins/' ) ); ?></p>
     88            </section>
     89
     90            <section class="community-2">
     91                <div class="screen"></div>
     92                <div class="container">
     93                    <h2><?php _e( 'Community' ); ?></h2>
     94                    <p class="subheading"><?php _e( 'Hundreds of thousands of developers, content creators, and site owners gather at monthly meetups in 436 cities worldwide' ); ?>.</p>
     95                </div>
     96            </section>
     97
     98            <section class="get">
     99                <h2><?php _e( 'Get Started with WordPress' ); ?></h2>
     100                <p class="subheading"><?php _e( 'Over 60 million people have chosen WordPress to power the place on the web they call &ldquo;home&rdquo; &mdash; join the family.' ); ?></p>
     101                <div class="cta-wrapper">
     102                    <a href="https://wordpress.org/download/" class="button button-primary button-xl"><?php _e( 'Get WordPress' ); ?></a>
     103                </div>
     104            </section>
     105        </div>
     106
     107        <div id="home-below" class="home-below">
     108            <div class="col-2">
     109                <h4><a href="https://wordpress.org/about/swag/"><?php _e( 'WordPress&nbsp;Swag' ); ?></a></h4>
     110                <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' ); ?>" /></a>
    55111            </div>
    56         </section>
    57112
    58         <section class="showcase">
    59             <h2><?php _e( 'Trusted by the Best' ); ?></h2>
    60             <p class="subheading"><?php _e( '28% of the web uses WordPress, from hobby blogs to the biggest news sites online.' ); ?></p>
    61             <div class="collage">
     113            <div class="col-4">
     114                <h4><a href="https://wordpress.org/news/"><?php _e( 'News From Our Blog' ); ?></a></h4>
    62115
     116                <?php
     117                foreach ( get_posts( [ 'numberposts' => 1 ] ) as $featured_post ) :
     118                    setup_postdata( $featured_post );
     119                    the_title( sprintf( '<h5><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h5>' );
     120                    echo '<p>' . apply_filters( 'the_excerpt', get_the_excerpt() ) . '</p>';
     121                endforeach;
     122                wp_reset_postdata();
     123                ?>
    63124            </div>
    64             <p class="cta-link"><a href="https://wordpress.org/showcase/"><?php _e( 'Discover more sites built with WordPress' ); ?></a>.</p>
    65         </section>
    66125
    67         <section class="features">
    68             <h2><?php _e( 'Powerful Features' ); ?></h2>
    69             <p class="subheading"><?php _e( 'Limitless possibilities. What will you create?' ); ?></p>
    70             <ul>
    71                 <li>
    72                     <span class="dashicons dashicons-admin-customizer"></span>
    73                     <?php _e( 'Customizable<br />Designs' ); ?>
    74                 </li>
    75                 <li>
    76                     <span class="dashicons dashicons-welcome-widgets-menus"></span>
    77                     <?php _e( 'SEO<br />Friendly' ); ?>
    78                 </li>
    79                 <li>
    80                     <span class="dashicons dashicons-smartphone"></span>
    81                     <?php _e( 'Responsive<br />Mobile Sites' ); ?>
    82                 </li>
    83                 <li>
    84                     <span class="dashicons dashicons-chart-line"></span>
    85                     <?php _e( 'High<br />Performance' ); ?>
    86                 </li>
    87                 <li>
    88                     <a href="https://wordpress.org/mobile/"><img src="https://s.w.org/images/home/icon-run-blue.svg" />
    89                         <?php _e( 'Manage<br />on the Go' ); ?></a>
    90                 </li>
    91                 <li>
    92                     <span class="dashicons dashicons-lock"></span>
    93                     <?php _e( 'High<br />Security' ); ?>
    94                 </li>
    95                 <li>
    96                     <span class="dashicons dashicons-images-alt2"></span>
    97                     <?php _e( 'Powerful<br />Media Management' ); ?>
    98                 </li>
    99                 <li>
    100                     <span class="dashicons dashicons-universal-access"></span>
    101                     <?php _e( 'Easy and<br />Accessible' ); ?>
    102                 </li>
    103             </ul>
    104             <p><?php
    105                 /* translators: %s: Link to Plugin Directory. */
    106                 printf( __( 'Extend WordPress with over 45,000 plugins to help your website meet your needs. Add an online store, galleries, mailing lists, forums, analytics, and <a href="%s">much more</a>.' ), esc_url( 'https://wordpress.org/plugins/' ) ); ?></p>
    107         </section>
     126            <div class="col-4">
     127                <h4><?php _e( 'It&rsquo;s Easy&nbsp;As&hellip;' ); ?></h4>
    108128
    109         <section class="community-2">
    110             <div class="screen"></div>
    111             <div class="container">
    112                 <h2><?php _e( 'Community' ); ?></h2>
    113                 <p class="subheading"><?php _e( 'Hundreds of thousands of developers, content creators, and site owners gather at monthly meetups in 436 cities worldwide' ); ?>.</p>
     129                <ol class="steps">
     130                    <li class="one"><span></span><?php printf( __( '<a href="%s">Find a Web Host</a> and get great hosting while supporting WordPress at the same&nbsp;time.' ), esc_url( 'https://wordpress.org/hosting/' ) ); ?></li>
     131                    <li class="two"><span></span><?php printf( __( '<a href="%s">Download &amp; Install WordPress</a> with our famous 5-minute&nbsp;installation. Feel like a rock star.' ), esc_url( 'https://wordpress.org/download/' ) ); ?></li>
     132                    <li class="three"><span></span><?php printf( __( '<a href="%s">Read the Documentation</a> and become a WordPress expert yourself, impress your friends.' ), esc_url( 'https://developer.wordpress.org' ) ); ?></li>
     133                </ol>
    114134            </div>
    115         </section>
    116135
    117         <section class="get">
    118             <h2><?php _e( 'Get Started with WordPress' ); ?></h2>
    119             <p class="subheading"><?php _e( 'Over 60 million people have chosen WordPress to power the place on the web they call &ldquo;home&rdquo; &mdash; join the family.' ); ?></p>
    120             <div class="cta-wrapper">
    121                 <a href="https://wordpress.org/download/" class="button button-primary button-xl"><?php _e( 'Get WordPress' ); ?></a>
    122             </div>
    123         </section>
     136            <div class="col-2">
     137                <h4><a href="https://wordpress.org/showcase/"><?php _e( 'WordPress&nbsp;Users' ); ?></a></h4>
    124138
    125         <div id="home-below">
    126             <div class="wrapper">
    127                 <div class="col-2">
    128                     <h4><a href="https://wordpress.org/about/swag/"><?php _e( 'WordPress&nbsp;Swag' ); ?></a></h4>
    129                     <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' ); ?>" /></a>
    130                 </div>
     139                <ul id="notable-users">
     140                    <?php
     141                        $links = array(
     142                            'nytimes'       => 'https://wordpress.org/showcase/tag/new-york-times/',
     143                            'cnn'           => 'https://wordpress.org/showcase/tag/cnn/',
     144                            'rollingstones' => 'https://wordpress.org/showcase/the-rolling-stones/',
     145                            'people'        => 'https://wordpress.org/showcase/stylewatch-off-the-rack/',
     146                            'playstation'   => 'https://wordpress.org/showcase/playstationblog/',
     147                            'motleycrue'    => 'https://wordpress.org/showcase/motley-crue/',
     148                            'blondie'       => 'https://wordpress.org/showcase/blondie/',
     149                            'marthastewart' => 'https://wordpress.org/showcase/themarthablog/',
     150                        );
    131151
    132                 <div class="col-4">
    133                     <h4><a href="https://wordpress.org/news/"><?php _e( 'News From Our Blog' ); ?></a></h4>
    134 
    135                     <h5><a href="<?php echo $latest_post['link']; ?>"><?php echo $latest_post['title']; ?></a></h5>
    136                     <p><?php echo $latest_post['content']; ?></p>
    137                 </div>
    138 
    139                 <div class="col-4">
    140                     <h4><?php _e( 'It&rsquo;s Easy&nbsp;As&hellip;' ); ?></h4>
    141 
    142                     <ol class="steps">
    143                         <li class="one"><span></span><?php printf( __( '<a href="%s">Find a Web Host</a> and get great hosting while supporting WordPress at the same&nbsp;time.' ), esc_url( 'https://wordpress.org/hosting/' ) ); ?></li>
    144                         <li class="two"><span></span><?php printf( __( '<a href="%s">Download &amp; Install WordPress</a> with our famous 5-minute&nbsp;installation. Feel like a rock star.' ), esc_url( 'https://wordpress.org/download/' ) ); ?></li>
    145                         <li class="three"><span></span><?php printf( __( '<a href="%s">Read the Documentation</a> and become a WordPress expert yourself, impress your friends.' ), esc_url( 'https://developer.wordpress.org' ) ); ?></li>
    146 
    147                     </ol>
    148                 </div>
    149 
    150                 <div class="col-2">
    151                     <h4><a href="https://wordpress.org/showcase/"><?php _e( 'WordPress&nbsp;Users' ); ?></a></h4>
    152                     <ul id="notable-users">
    153                         <?php
    154                             $links = array(
    155                                 'nytimes'       => 'https://wordpress.org/showcase/tag/new-york-times/',
    156                                 'cnn'           => 'https://wordpress.org/showcase/tag/cnn/',
    157                                 'rollingstones' => 'https://wordpress.org/showcase/the-rolling-stones/',
    158                                 'people'        => 'https://wordpress.org/showcase/stylewatch-off-the-rack/',
    159                                 'playstation'   => 'https://wordpress.org/showcase/playstationblog/',
    160                                 'motleycrue'    => 'https://wordpress.org/showcase/motley-crue/',
    161                                 'blondie'       => 'https://wordpress.org/showcase/blondie/',
    162                                 'marthastewart' => 'https://wordpress.org/showcase/themarthablog/',
     152                        foreach ( array_rand( $links, 3 ) as $slug ) :
     153                            printf(
     154                                '<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>',
     155                                $links[ $slug ],
     156                                $slug
    163157                            );
    164 
    165                             foreach ( array_rand( $links, 3 ) as $slug ) :
    166                                 printf(
    167                                     '<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>',
    168                                     $links[ $slug ],
    169                                     $slug
    170                                 );
    171                             endforeach;
    172                         ?>
    173                     </ul>
    174                     <p id="showcase-link"><a href="https://wordpress.org/showcase/"><?php _e( '&hellip; and hundreds more' ); ?></a></p>
    175                 </div>
     158                        endforeach;
     159                    ?>
     160                </ul>
     161                <p id="showcase-link"><a href="https://wordpress.org/showcase/"><?php _e( '&hellip; and hundreds more' ); ?></a></p>
    176162            </div>
    177163        </div>
Note: See TracChangeset for help on using the changeset viewer.