Pass taxonomy to post_tags_meta_box. Use add_new_item label. see #13805

git-svn-id: http://svn.automattic.com/wordpress/trunk@15183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-06-09 21:59:13 +00:00
parent fe4edfc76d
commit 15e9538874
2 changed files with 11 additions and 5 deletions

View File

@ -117,7 +117,7 @@ foreach ( get_object_taxonomies($post_type) as $tax_name ) {
$label = $taxonomy->labels->name; $label = $taxonomy->labels->name;
if ( !is_taxonomy_hierarchical($tax_name) ) if ( !is_taxonomy_hierarchical($tax_name) )
add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core'); add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
else else
add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name )); add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', $post_type, 'side', 'core', array( 'taxonomy' => $tax_name ));
} }

View File

@ -242,10 +242,16 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0
* @param object $post * @param object $post
*/ */
function post_tags_meta_box($post, $box) { function post_tags_meta_box($post, $box) {
$tax_name = esc_attr(substr($box['id'], 8)); $defaults = array('taxonomy' => 'post_tag');
$taxonomy = get_taxonomy($tax_name); if ( !isset($box['args']) || !is_array($box['args']) )
$args = array();
else
$args = $box['args'];
extract( wp_parse_args($args, $defaults), EXTR_SKIP );
$tax_name = esc_attr($taxonomy);
$taxonomy = get_taxonomy($taxonomy);
$helps = isset( $taxonomy->helps ) ? esc_attr( $taxonomy->helps ) : esc_attr__('Separate tags with commas.'); $helps = isset( $taxonomy->helps ) ? esc_attr( $taxonomy->helps ) : esc_attr__('Separate tags with commas.');
$help_hint = isset( $taxonomy->help_hint ) ? $taxonomy->help_hint : __('Add new tag');
$help_nojs = isset( $taxonomy->help_nojs ) ? $taxonomy->help_nojs : __('Add or remove tags'); $help_nojs = isset( $taxonomy->help_nojs ) ? $taxonomy->help_nojs : __('Add or remove tags');
$help_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud : __('Choose from the most used tags'); $help_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud : __('Choose from the most used tags');
@ -259,7 +265,7 @@ function post_tags_meta_box($post, $box) {
<?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
<div class="ajaxtag hide-if-no-js"> <div class="ajaxtag hide-if-no-js">
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
<div class="taghint"><?php echo $help_hint; ?></div> <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
<p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /></p> <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /></p>
</div> </div>