Ticket #9381: 9381.002.diff

File 9381.002.diff, 4.7 KB (added by aaroncampbell, 3 years ago)
  • trunk/wp-includes/category-template.php

     
    293293 * @return string Category description, available. 
    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 
    303299/** 
     
    799795} 
    800796 
    801797/** 
     798 * Retrieve tag description. 
     799 * 
     800 * @since 2.9 
     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.9 
     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 * 
    804830 * This function can only be used within the loop. 
  • trunk/wp-admin/admin-ajax.php

     
    11691169                        else 
    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) ) { 
    11741177                                $tag = get_term( $updated['term_id'], $taxonomy ); 
  • trunk/wp-admin/includes/template.php

     
    668668                                        $out .= '<div class="name">' . $qe_data->name . '</div>'; 
    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>"; 
    673676                                        break; 
     
    872875                        $_wp_column_headers[$page] = array( 
    873876                                'cb' => '<input type="checkbox" />', 
    874877                                'name' => __('Name'), 
     878                                'description' => __('Description'), 
    875879                                'slug' => __('Slug'), 
    876880                                'posts' => __('Posts') 
    877881                        ); 
  • trunk/wp-admin/edit-tags.php

     
    287287        <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> 
    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'); ?> 
    292298</form></div> 
  • trunk/wp-admin/edit-tag-form.php

     
    3434                        <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" /> 
    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> 
    3944<?php do_action('edit_tag_form', $tag); ?>