mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 22:58:40 +02:00
Add taxonomy argument to wp_tag_cloud()
git-svn-id: http://svn.automattic.com/wordpress/trunk@10554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7bb01e4c48
commit
57c3eba439
@ -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>
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user