Make WordPress Core


Ignore:
Timestamp:
07/03/2015 08:46:54 PM (9 years ago)
Author:
boonebgorges
Message:

Improve the display of my-sites.php on small screens.

Props tryon.
Fixes #31685.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/my-sites.php

    r32974 r33072  
    6969    choose_primary_blog();
    7070    /**
    71      * Fires before the sites table on the My Sites screen.
     71     * Fires before the sites list on the My Sites screen.
    7272     *
    7373     * @since 3.0.0
     
    7676    ?>
    7777    <br clear="all" />
    78     <table class="widefat fixed striped">
     78    <ul class="my-sites striped">
    7979    <?php
    8080    /**
     
    9292    $settings_html = apply_filters( 'myblogs_options', '', 'global' );
    9393    if ( $settings_html != '' ) {
    94         echo '<tr><td><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
     94        echo '<h3>' . __( 'Global Settings' ) . '</h3>';
    9595        echo $settings_html;
    96         echo '</td></tr>';
    9796    }
    9897    reset( $blogs );
    99     $num = count( $blogs );
    100     $cols = 1;
    101     if ( $num >= 20 )
    102         $cols = 4;
    103     elseif ( $num >= 10 )
    104         $cols = 2;
    105     $num_rows = ceil( $num / $cols );
    106     $split = 0;
    107     for ( $i = 1; $i <= $num_rows; $i++ ) {
    108         $rows[] = array_slice( $blogs, $split, $cols );
    109         $split = $split + $cols;
    110     }
    11198
    112     foreach ( $rows as $row ) {
    113         echo "<tr>";
    114         $i = 0;
    115         foreach ( $row as $user_blog ) {
    116             $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
    117             echo "<td style='$s'>";
    118             echo "<h3>{$user_blog->blogname}</h3>";
    119             /**
    120              * Filter the row links displayed for each site on the My Sites screen.
    121              *
    122              * @since MU
    123              *
    124              * @param string $string    The HTML site link markup.
    125              * @param object $user_blog An object containing the site data.
    126              */
    127             echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
    128             /** This filter is documented in wp-admin/my-sites.php */
    129             echo apply_filters( 'myblogs_options', '', $user_blog );
    130             echo "</td>";
    131             $i++;
    132         }
    133         echo "</tr>";
     99    foreach ( $blogs as $user_blog ) {
     100        echo "<li>";
     101        echo "<h3>{$user_blog->blogname}</h3>";
     102        /**
     103         * Filter the row links displayed for each site on the My Sites screen.
     104         *
     105         * @since MU
     106         *
     107         * @param string $string    The HTML site link markup.
     108         * @param object $user_blog An object containing the site data.
     109         */
     110        echo "<p class='my-sites-actions'>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
     111        /** This filter is documented in wp-admin/my-sites.php */
     112        echo apply_filters( 'myblogs_options', '', $user_blog );
     113        echo "</li>";
    134114    }?>
    135     </table>
     115    </ul>
    136116    <input type="hidden" name="action" value="updateblogsettings" />
    137117    <?php wp_nonce_field( 'update-my-sites' ); ?>
Note: See TracChangeset for help on using the changeset viewer.