WordPress.org

Make WordPress Core

Ticket #10432: current-tag.patch

File current-tag.patch, 1.6 KB (added by edward mindreantre, 8 years ago)
  • wp-includes/category-template.php

    ### Eclipse Workspace Patch 1.0
    #P Wordpress
     
    550550
    551551        if ( empty( $tags ) )
    552552                return;
    553 
     553               
     554        global $wp_query;
     555        $queried_object_id = $wp_query->get_queried_object_id();
     556               
    554557        foreach ( $tags as $key => $tag ) {
    555558                if ( 'edit' == $args['link'] )
    556559                        $link = get_edit_tag_link( $tag->term_id, $args['taxonomy'] );
     
    561564
    562565                $tags[ $key ]->link = $link;
    563566                $tags[ $key ]->id = $tag->term_id;
     567                $tags[ $key ]->current = ($tags[ $key ]->id == $queried_object_id);
    564568        }
    565 
     569       
    566570        $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
    567571
    568572        $return = apply_filters( 'wp_tag_cloud', $return, $args );
     
    693697                $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
    694698                $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
    695699                $tag_name = $tags[ $key ]->name;
    696                 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $topic_count_text_callback( $real_count ) ) . "' style='font-size: " .
     700               
     701                $tag_classes = "tag-link-$tag_id";
     702                if ($tag->current === true)
     703                        $tag_classes .= ' current-tag';
     704               
     705                $a[] = "<a href='$tag_link' class='$tag_classes' title='" . esc_attr( $topic_count_text_callback( $real_count ) ) . "' style='font-size: " .
    697706                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
    698                         . "$unit;'>$tag_name</a>";
     707                        . "$unit;' >$tag_name</a>";
    699708        }
    700709
    701710        switch ( $format ) :