<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12966] trunk/wp-admin/includes/template.php:
  update wp_popular_terms_checklist() to handle custom taxonomies.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12966">12966</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-02-05 14:16:31 +0000 (Fri, 05 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>update wp_popular_terms_checklist() to handle custom taxonomies. See <a href="http://trac.wordpress.org/ticket/10122">#10122</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12965 => 12966)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-02-05 14:00:18 UTC (rev 12965)
+++ trunk/wp-admin/includes/template.php        2010-02-05 14:16:31 UTC (rev 12966)
</span><span class="lines">@@ -582,25 +582,25 @@
</span><span class="cx">         global $post_ID;
</span><span class="cx"> 
</span><span class="cx">         if ( $post_ID )
</span><del>-                $checked_categories = wp_get_object_terms($post_ID, 'category', array('fields'=&gt;'ids'));
</del><ins>+                $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=&gt;'ids'));
</ins><span class="cx">         else
</span><del>-                $checked_categories = array();
</del><ins>+                $checked_terms = array();
</ins><span class="cx"> 
</span><del>-        $categories = get_terms( $taxonomy, array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC', 'number' =&gt; $number, 'hierarchical' =&gt; false ) );
</del><ins>+        $terms = get_terms( $taxonomy, array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC', 'number' =&gt; $number, 'hierarchical' =&gt; false ) );
</ins><span class="cx"> 
</span><span class="cx">         $popular_ids = array();
</span><del>-        foreach ( (array) $categories as $category ) {
-                $popular_ids[] = $category-&gt;term_id;
</del><ins>+        foreach ( (array) $terms as $term ) {
+                $popular_ids[] = $term-&gt;term_id;
</ins><span class="cx">                 if ( !$echo ) // hack for AJAX use
</span><span class="cx">                         continue;
</span><del>-                $id = &quot;popular-$taxonomy-$category-&gt;term_id&quot;;
-                $checked = in_array( $category-&gt;term_id, $checked_categories ) ? 'checked=&quot;checked&quot;' : '';
</del><ins>+                $id = &quot;popular-$taxonomy-$term-&gt;term_id&quot;;
+                $checked = in_array( $term-&gt;term_id, $checked_terms ) ? 'checked=&quot;checked&quot;' : '';
</ins><span class="cx">                 ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;li id=&quot;&lt;?php echo $id; ?&gt;&quot; class=&quot;popular-category&quot;&gt;
</span><span class="cx">                         &lt;label class=&quot;selectit&quot;&gt;
</span><del>-                        &lt;input id=&quot;in-&lt;?php echo $id; ?&gt;&quot; type=&quot;checkbox&quot; &lt;?php echo $checked; ?&gt; value=&quot;&lt;?php echo (int) $category-&gt;term_id; ?&gt;&quot; /&gt;
-                                &lt;?php echo esc_html( apply_filters( 'the_category', $category-&gt;name ) ); ?&gt;
</del><ins>+                        &lt;input id=&quot;in-&lt;?php echo $id; ?&gt;&quot; type=&quot;checkbox&quot; &lt;?php echo $checked; ?&gt; value=&quot;&lt;?php echo (int) $term-&gt;term_id; ?&gt;&quot; /&gt;
+                                &lt;?php echo esc_html( apply_filters( 'the_category', $term-&gt;name ) ); ?&gt;
</ins><span class="cx">                         &lt;/label&gt;
</span><span class="cx">                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -2699,7 +2699,7 @@
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;/select&gt;
</span><span class="cx"> &lt;input class=&quot;hide-if-js&quot; type=&quot;text&quot; id=&quot;metakeyinput&quot; name=&quot;metakeyinput&quot; tabindex=&quot;7&quot; value=&quot;&quot; /&gt;
</span><del>-&lt;a href=&quot;#postcustomstuff&quot; class=&quot;hide-if-no-js&quot; onclick=&quot;jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;&quot;&gt;
</del><ins>+&lt;a href=&quot;#postcustomstuff&quot; class=&quot;hide-if-no-js&quot; onClick=&quot;jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;&quot;&gt;
</ins><span class="cx"> &lt;span id=&quot;enternew&quot;&gt;&lt;?php _e('Enter new'); ?&gt;&lt;/span&gt;
</span><span class="cx"> &lt;span id=&quot;cancelnew&quot; class=&quot;hidden&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/span&gt;&lt;/a&gt;
</span><span class="cx"> &lt;?php } else { ?&gt;
</span><span class="lines">@@ -3376,7 +3376,7 @@
</span><span class="cx">                                 &lt;?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?&gt;
</span><span class="cx">                                 &lt;label class=&quot;screen-reader-text&quot; for=&quot;find-posts-input&quot;&gt;&lt;?php _e( 'Search' ); ?&gt;&lt;/label&gt;
</span><span class="cx">                                 &lt;input type=&quot;text&quot; id=&quot;find-posts-input&quot; name=&quot;ps&quot; value=&quot;&quot; /&gt;
</span><del>-                                &lt;input type=&quot;button&quot; onclick=&quot;findPosts.send();&quot; value=&quot;&lt;?php esc_attr_e( 'Search' ); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
</del><ins>+                                &lt;input type=&quot;button&quot; onClick=&quot;findPosts.send();&quot; value=&quot;&lt;?php esc_attr_e( 'Search' ); ?&gt;&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;input type=&quot;radio&quot; name=&quot;find-posts-what&quot; id=&quot;find-posts-posts&quot; checked=&quot;checked&quot; value=&quot;posts&quot; /&gt;
</span><span class="cx">                                 &lt;label for=&quot;find-posts-posts&quot;&gt;&lt;?php _e( 'Posts' ); ?&gt;&lt;/label&gt;
</span><span class="lines">@@ -3386,7 +3386,7 @@
</span><span class="cx">                         &lt;div id=&quot;find-posts-response&quot;&gt;&lt;/div&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx">                 &lt;div class=&quot;find-box-buttons&quot;&gt;
</span><del>-                        &lt;input type=&quot;button&quot; class=&quot;button alignleft&quot; onclick=&quot;findPosts.close();&quot; value=&quot;&lt;?php esc_attr_e('Close'); ?&gt;&quot; /&gt;
</del><ins>+                        &lt;input type=&quot;button&quot; class=&quot;button alignleft&quot; onClick=&quot;findPosts.close();&quot; value=&quot;&lt;?php esc_attr_e('Close'); ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;input id=&quot;find-posts-submit&quot; type=&quot;submit&quot; class=&quot;button-primary alignright&quot; value=&quot;&lt;?php esc_attr_e('Select'); ?&gt;&quot; /&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx">         &lt;/div&gt;
</span></span></pre>
</div>
</div>

</body>
</html>