Tag descriptions, props aaroncampbell, fixes #9381
git-svn-id: http://svn.automattic.com/wordpress/trunk@10903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
135af2d731
commit
9d35395cb5
|
@ -1169,6 +1169,9 @@ case 'inline-save-tax':
|
||||||
else
|
else
|
||||||
$taxonomy = 'post_tag';
|
$taxonomy = 'post_tag';
|
||||||
|
|
||||||
|
$tag = get_term( $id, $taxonomy );
|
||||||
|
$_POST['description'] = $tag->description;
|
||||||
|
|
||||||
$updated = wp_update_term($id, $taxonomy, $_POST);
|
$updated = wp_update_term($id, $taxonomy, $_POST);
|
||||||
if ( $updated && !is_wp_error($updated) ) {
|
if ( $updated && !is_wp_error($updated) ) {
|
||||||
$tag = get_term( $updated['term_id'], $taxonomy );
|
$tag = get_term( $updated['term_id'], $taxonomy );
|
||||||
|
|
|
@ -34,6 +34,11 @@ do_action('edit_tag_form_pre', $tag); ?>
|
||||||
<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" />
|
<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" />
|
||||||
<p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
|
<p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="form-field">
|
||||||
|
<th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
|
||||||
|
<td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($tag->description); ?></textarea><br />
|
||||||
|
<?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
|
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
|
||||||
<?php do_action('edit_tag_form', $tag); ?>
|
<?php do_action('edit_tag_form', $tag); ?>
|
||||||
|
|
|
@ -287,6 +287,12 @@ else
|
||||||
<p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
|
<p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-field">
|
||||||
|
<label for="description"><?php _e('Description') ?></label>
|
||||||
|
<textarea name="description" id="description" rows="5" cols="40"></textarea>
|
||||||
|
<p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
|
<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
|
||||||
<?php do_action('add_tag_form'); ?>
|
<?php do_action('add_tag_form'); ?>
|
||||||
</form></div>
|
</form></div>
|
||||||
|
|
|
@ -668,6 +668,9 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
|
||||||
$out .= '<div class="name">' . $qe_data->name . '</div>';
|
$out .= '<div class="name">' . $qe_data->name . '</div>';
|
||||||
$out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
|
$out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
|
||||||
break;
|
break;
|
||||||
|
case 'description':
|
||||||
|
$out .= "<td $attributes>$tag->description</td>";
|
||||||
|
break;
|
||||||
case 'slug':
|
case 'slug':
|
||||||
$out .= "<td $attributes>$tag->slug</td>";
|
$out .= "<td $attributes>$tag->slug</td>";
|
||||||
break;
|
break;
|
||||||
|
@ -872,6 +875,7 @@ function get_column_headers($page) {
|
||||||
$_wp_column_headers[$page] = array(
|
$_wp_column_headers[$page] = array(
|
||||||
'cb' => '<input type="checkbox" />',
|
'cb' => '<input type="checkbox" />',
|
||||||
'name' => __('Name'),
|
'name' => __('Name'),
|
||||||
|
'description' => __('Description'),
|
||||||
'slug' => __('Slug'),
|
'slug' => __('Slug'),
|
||||||
'posts' => __('Posts')
|
'posts' => __('Posts')
|
||||||
);
|
);
|
||||||
|
|
|
@ -293,11 +293,7 @@ function the_category( $separator = '', $parents='', $post_id = false ) {
|
||||||
* @return string Category description, available.
|
* @return string Category description, available.
|
||||||
*/
|
*/
|
||||||
function category_description( $category = 0 ) {
|
function category_description( $category = 0 ) {
|
||||||
global $cat;
|
return term_description( $category, 'category' );
|
||||||
if ( !$category )
|
|
||||||
$category = $cat;
|
|
||||||
|
|
||||||
return get_term_field( 'description', $category, 'category' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -798,6 +794,36 @@ function the_tags( $before = null, $sep = ', ', $after = '' ) {
|
||||||
echo get_the_tag_list($before, $sep, $after);
|
echo get_the_tag_list($before, $sep, $after);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve tag description.
|
||||||
|
*
|
||||||
|
* @since 2.8
|
||||||
|
*
|
||||||
|
* @param int $tag Optional. Tag ID. Will use global tag ID by default.
|
||||||
|
* @return string Tag description, available.
|
||||||
|
*/
|
||||||
|
function tag_description( $tag = 0 ) {
|
||||||
|
return term_description( $tag );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve term description.
|
||||||
|
*
|
||||||
|
* @since 2.8
|
||||||
|
*
|
||||||
|
* @param int $term Optional. Term ID. Will use global term ID by default.
|
||||||
|
* @return string Term description, available.
|
||||||
|
*/
|
||||||
|
function term_description( $term = 0, $taxonomy = 'post_tag' ) {
|
||||||
|
if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
|
||||||
|
global $wp_query;
|
||||||
|
$term = $wp_query->get_queried_object();
|
||||||
|
$taxonomy = $term->taxonomy;
|
||||||
|
$term = $term->term_id;
|
||||||
|
}
|
||||||
|
return get_term_field( 'description', $term, $taxonomy );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the terms of the taxonomy that are attached to the post.
|
* Retrieve the terms of the taxonomy that are attached to the post.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue