Make WordPress Core

Changeset 12966


Ignore:
Timestamp:
02/05/2010 02:16:31 PM (15 years ago)
Author:
dd32
Message:

update wp_popular_terms_checklist() to handle custom taxonomies. See #10122

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r12927 r12966  
    583583
    584584    if ( $post_ID )
    585         $checked_categories = wp_get_object_terms($post_ID, 'category', array('fields'=>'ids'));
     585        $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids'));
    586586    else
    587         $checked_categories = array();
    588 
    589     $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
     587        $checked_terms = array();
     588
     589    $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
    590590
    591591    $popular_ids = array();
    592     foreach ( (array) $categories as $category ) {
    593         $popular_ids[] = $category->term_id;
     592    foreach ( (array) $terms as $term ) {
     593        $popular_ids[] = $term->term_id;
    594594        if ( !$echo ) // hack for AJAX use
    595595            continue;
    596         $id = "popular-$taxonomy-$category->term_id";
    597         $checked = in_array( $category->term_id, $checked_categories ) ? 'checked="checked"' : '';
     596        $id = "popular-$taxonomy-$term->term_id";
     597        $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
    598598        ?>
    599599
    600600        <li id="<?php echo $id; ?>" class="popular-category">
    601601            <label class="selectit">
    602             <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $category->term_id; ?>" />
    603                 <?php echo esc_html( apply_filters( 'the_category', $category->name ) ); ?>
     602            <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" />
     603                <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
    604604            </label>
    605605        </li>
     
    27002700</select>
    27012701<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
    2702 <a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
     2702<a href="#postcustomstuff" class="hide-if-no-js" onClick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
    27032703<span id="enternew"><?php _e('Enter new'); ?></span>
    27042704<span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
     
    33773377                <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
    33783378                <input type="text" id="find-posts-input" name="ps" value="" />
    3379                 <input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />
     3379                <input type="button" onClick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />
    33803380
    33813381                <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
     
    33873387        </div>
    33883388        <div class="find-box-buttons">
    3389             <input type="button" class="button alignleft" onclick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" />
     3389            <input type="button" class="button alignleft" onClick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" />
    33903390            <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" />
    33913391        </div>
Note: See TracChangeset for help on using the changeset viewer.