Add taxonomy argument to wp_tag_cloud()

git-svn-id: https://develop.svn.wordpress.org/trunk@10554 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-02-11 23:41:29 +00:00
parent a99acb3cfd
commit 0066076858
3 changed files with 7 additions and 7 deletions

View File

@ -244,9 +244,9 @@ if ( $page_links )
<h3><?php _e('Popular Tags'); ?></h3> <h3><?php _e('Popular Tags'); ?></h3>
<?php <?php
if ( $can_manage ) if ( $can_manage )
wp_tag_cloud(array('link' => 'edit')); wp_tag_cloud(array('taxonomy' => $taxonomy, 'link' => 'edit'));
else else
wp_tag_cloud(); wp_tag_cloud(array('taxonomy' => $taxonomy));
?> ?>
</div> </div>

View File

@ -560,20 +560,20 @@ function wp_tag_cloud( $args = '' ) {
$defaults = array( $defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => '', 'link' => 'view' 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag'
); );
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
$tags = get_tags( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
if ( empty( $tags ) ) if ( empty( $tags ) )
return; return;
foreach ( $tags as $key => $tag ) { foreach ( $tags as $key => $tag ) {
if ( 'edit' == $args['link'] ) if ( 'edit' == $args['link'] )
$link = get_edit_tag_link( $tag->term_id ); $link = get_edit_tag_link( $tag->term_id, $args['taxonomy'] );
else else
$link = get_tag_link( $tag->term_id ); $link = get_term_link( $tag->term_id, $args['taxonomy'] );
if ( is_wp_error( $link ) ) if ( is_wp_error( $link ) )
return false; return false;

View File

@ -575,7 +575,7 @@ function get_tag_feed_link($tag_id, $feed = '') {
* @return string * @return string
*/ */
function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) { function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
$tag = get_term($tag_id, 'post_tag'); $tag = get_term($tag_id, $taxonomy);
if ( !current_user_can('manage_categories') ) if ( !current_user_can('manage_categories') )
return; return;