Making WordPress.org


Ignore:
Timestamp:
07/12/2016 12:06:42 AM (9 years ago)
Author:
drewapicture
Message:

developer.wordpress.org: Display changelog data in a table, ordered newest-to-oldest.

See #1819. See #1820.

File:
1 edited

Legend:

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

    r3660 r3668  
    1515    <section class="changelog">
    1616        <h3><?php _e( 'Changelog', 'wporg' ); ?></h3>
    17         <ul>
    18             <?php foreach ( $changelog_data as $version => $data ) : ?>
    19                 <li>
    20                     <strong><?php _e( 'Since:', 'wporg' ); ?></strong>
    21                     <?php printf(
    22                     /* translators: %s: WordPress version */
    23                         __( 'WordPress %s', 'wporg' ),
    24                         sprintf( '<a href="%1$s">%2$s</a>', esc_url( $data['since_url'] ), esc_html( $version ) )
    25                     ); ?>
    26                     <?php echo $data['description']; // escaped in get_changelog_data() ?>
    27                 </li>
    28             <?php endforeach; ?>
    29         </ul>
     17
     18        <table>
     19            <caption class="screen-reader-text"><?php _e( 'Changelog', 'wporg' ); ?></caption>
     20            <thead>
     21                <tr>
     22                    <th class="changelog-version"><?php _e( 'Version', 'wporg' ); ?></th>
     23                    <th class="changelog-desc"><?php _e( 'Description', 'wporg' ); ?></th>
     24                </tr>
     25            </thead>
     26
     27            <tbody>
     28                <?php
     29                $count = count( $changelog_data );
     30                $i = 0;
     31
     32                $changelog_data = array_reverse( $changelog_data );
     33
     34                foreach ( $changelog_data as $version => $data ) : ?>
     35                    <?php
     36                    // Add "Introduced." for the initial version description, last since the array is reversed.
     37                    $data['description'] = ( $i == ( $count - 1 ) ) ? __( 'Introduced.', 'wporg' ) : $data['description'];
     38
     39                    $version_link = sprintf( '<a href="%1$s" alt="%2$s">%3$s</a>',
     40                        esc_url( $data['since_url'] ),
     41                        esc_attr( "WordPress {$version}" ),
     42                        esc_html( $version )
     43                    );
     44
     45                    $i++;
     46                    ?>
     47
     48                    <tr>
     49                        <td><?php echo $version_link; ?></td>
     50                        <td><?php echo $data['description']; ?></td>
     51                    </tr>
     52                <?php endforeach; ?>
     53            </tbody>
     54        </table>
    3055    </section>
    3156<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.