WordPress.org

Make WordPress Core

Changeset 6670


Ignore:
Timestamp:
01/28/2008 05:21:14 PM (14 years ago)
Author:
ryan
Message:

Tag searching from jhodgdon. see #5684

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-tags.php

    r6660 r6670  
    8787    <h2><?php _e('Tags') ?> </h2>
    8888<?php endif; ?>
     89
     90<form name="searchform" id="searchform" action="" method="get">
     91    <input type="text" name="s" id="s" value="<?php echo attribute_escape( stripslashes( $_GET[ 's' ]) ); ?>" size="17" />
     92    <input type="submit" id="post-query-submit" value="<?php _e('Search Tags'); ?>" class="button" />
     93</form>
     94<br style="clear:both;" />
     95
     96
    8997<table class="widefat">
    9098    <thead>
     
    102110    $tagsperpage = 20;
    103111}
    104 $count = tag_rows( $pagenum, $tagsperpage );
     112$searchterms = trim( $_GET['s'] );
     113
     114$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
    105115?>
    106116    </tbody>
  • trunk/wp-admin/includes/template.php

    r6660 r6670  
    262262// assuming M tags displayed at a time on the page
    263263// Returns the number of tags displayed
    264 function tag_rows( $page = 0, $pagesize = 20 ) {
     264function tag_rows( $page = 0, $pagesize = 20, $searchterms = '' ) {
    265265   
    266266    // Get a page worth of tags
    267267    $start = $page * $pagesize;
    268     $tags = get_terms( 'post_tag', "offset=$start&number=$pagesize&hide_empty=0"  );
     268
     269    $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
     270 
     271    if ( !empty( $searchterms ) )
     272        $args['name__like'] = $searchterms;
     273
     274    $tags = get_terms( 'post_tag', $args );
    269275   
    270276    // convert it to table rows
Note: See TracChangeset for help on using the changeset viewer.