Make WordPress Core

Changeset 10903


Ignore:
Timestamp:
04/09/2009 04:00:40 PM (17 years ago)
Author:
azaozz
Message:

Tag descriptions, props aaroncampbell, fixes #9381

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r10872 r10903  
    11701170                $taxonomy = 'post_tag';
    11711171
     1172            $tag = get_term( $id, $taxonomy );
     1173            $_POST['description'] = $tag->description;
     1174
    11721175            $updated = wp_update_term($id, $taxonomy, $_POST);
    11731176            if ( $updated && !is_wp_error($updated) ) {
  • trunk/wp-admin/edit-tag-form.php

    r10239 r10903  
    3535            <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
    3636        </tr>
     37        <tr class="form-field">
     38            <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
     39            <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($tag->description); ?></textarea><br />
     40            <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
     41        </tr>
    3742    </table>
    3843<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
  • trunk/wp-admin/edit-tags.php

    r10775 r10903  
    288288</div>
    289289
     290<div class="form-field">
     291    <label for="description"><?php _e('Description') ?></label>
     292    <textarea name="description" id="description" rows="5" cols="40"></textarea>
     293    <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
     294</div>
     295
    290296<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
    291297<?php do_action('add_tag_form'); ?>
  • trunk/wp-admin/includes/template.php

    r10893 r10903  
    669669                    $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
    670670                    break;
     671                case 'description':
     672                    $out .= "<td $attributes>$tag->description</td>";
     673                    break;
    671674                case 'slug':
    672675                    $out .= "<td $attributes>$tag->slug</td>";
     
    873876                'cb' => '<input type="checkbox" />',
    874877                'name' => __('Name'),
     878                'description' => __('Description'),
    875879                'slug' => __('Slug'),
    876880                'posts' => __('Posts')
  • trunk/wp-includes/category-template.php

    r10888 r10903  
    294294 */
    295295function category_description( $category = 0 ) {
    296     global $cat;
    297     if ( !$category )
    298         $category = $cat;
    299 
    300     return get_term_field( 'description', $category, 'category' );
     296    return term_description( $category, 'category' );
    301297}
    302298
     
    800796
    801797/**
     798 * Retrieve tag description.
     799 *
     800 * @since 2.8
     801 *
     802 * @param int $tag Optional. Tag ID. Will use global tag ID by default.
     803 * @return string Tag description, available.
     804 */
     805function tag_description( $tag = 0 ) {
     806    return term_description( $tag );
     807}
     808
     809/**
     810 * Retrieve term description.
     811 *
     812 * @since 2.8
     813 *
     814 * @param int $term Optional. Term ID. Will use global term ID by default.
     815 * @return string Term description, available.
     816 */
     817function term_description( $term = 0, $taxonomy = 'post_tag' ) {
     818    if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
     819        global $wp_query;
     820        $term = $wp_query->get_queried_object();
     821        $taxonomy = $term->taxonomy;
     822        $term = $term->term_id;
     823    }
     824    return get_term_field( 'description', $term, $taxonomy );
     825}
     826
     827/**
    802828 * Retrieve the terms of the taxonomy that are attached to the post.
    803829 *
Note: See TracChangeset for help on using the changeset viewer.