Make WordPress Core

Changeset 7972


Ignore:
Timestamp:
05/21/2008 05:36:41 PM (17 years ago)
Author:
ryan
Message:

Add theme paging for those who can't bear to pare down their huge theme collection. You know who you are. see #5486

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/themes.php

    r7961 r7972  
    3030$themes = get_themes();
    3131$ct = current_theme_info();
     32
     33ksort( $themes );
     34$theme_total = count( $themes );
     35$per_page = 15;
     36
     37if ( isset( $_GET['pagenum'] ) )
     38    $page = absint( $_GET['pagenum'] );
     39
     40if ( empty($page) )
     41    $page = 1;
     42
     43$start = $offset = ( $page - 1 ) * $per_page;
     44
     45$page_links = paginate_links( array(
     46    'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
     47    'format' => '',
     48    'total' => ceil($theme_total / $per_page),
     49    'current' => $page
     50));
     51
     52$themes = array_slice( $themes, $start, $per_page );
     53
    3254?>
    3355
     
    5173
    5274<h2><?php _e('Available Themes'); ?></h2>
    53 <?php if ( 1 < count($themes) ) { ?>
     75<br class="clear" />
     76
     77<?php if ( $page_links ) : ?>
     78<div class="tablenav">
     79<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
     80<br class="clear" />
     81</div>
     82<br class="clear" />
     83<?php endif; ?>
     84
     85<?php if ( 1 < $theme_total ) { ?>
    5486<table id="availablethemes" cellspacing="0" cellpadding="0">
    5587<?php
     
    113145<?php } ?>
    114146
     147<br class="clear" />
     148
     149<?php if ( $page_links ) : ?>
     150<div class="tablenav">
     151<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
     152<br class="clear" />
     153</div>
     154<?php endif; ?>
     155
     156<br class="clear" />
     157
    115158<?php
    116159// List broken themes, if any.
Note: See TracChangeset for help on using the changeset viewer.