Make WordPress Core

Opened 19 years ago

Closed 19 years ago

#4123 closed enhancement (fixed)

New function get_the_tag similar to get_the_category w/ patch

Reported by: tacker Owned by:
Priority: low Milestone: 2.2
Component: Template Version:
Severity: normal Keywords:
Cc: Focuses:

Description

  • wp-includes/category-template.php

     
    203203       echo get_the_tags( $before, $sep, $after );
    204204}
    205205
     206function get_the_tag($id = 0) {
     207    global $post;
     208    if ( !$post )
     209        return false; // in-the-loop function
     210
     211    $id = (int) $id;
     212    if ( !$id )
     213        $id = (int) $post->ID;
     214
     215    $tags = get_post_tags( $post->ID );
     216    if ( empty( $tags ) )
     217        return false;
     218
     219    return $tags;
     220}
     221
    206222function category_description($category = 0) {
    207223       global $cat;
    208224       if ( !$category )

Change History (4)

#1 @tacker
19 years ago

  • Type taskenhancement

#2 @foolswisdom
19 years ago

  • Milestone2.2

#3 @ryan
19 years ago

To be more consistent with the category API, your code in get_the_tag() should replace the code in get_the_tags(), and the code currently in get_the_tags() should be in the_tags().

#4 @ryan
19 years ago

  • Resolutionfixed
  • Status newclosed

(In [5235]) Change get_the_tags() to return an array of tags. Move tag list code to the_tags(). fixes #4123

Note: See TracTickets for help on using tickets.