Add some custom taxonomy flags to allow fully customize strings in the taxonomy meta box. see #11838

git-svn-id: http://svn.automattic.com/wordpress/trunk@13538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-01 21:04:37 +00:00
parent 9f0db9355a
commit b657e01fad
2 changed files with 11 additions and 6 deletions

View File

@ -620,8 +620,10 @@ case 'get-tagcloud' :
$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
if ( empty( $tags ) )
die( __('No tags found!') );
if ( empty( $tags ) ) {
$tax = get_taxonomy( $taxonomy );
die( isset( $tax->no_tagcloud ) ? $tax->no_tagcloud : __('No tags found!') );
}
if ( is_wp_error($tags) )
die($tags->get_error_message());

View File

@ -249,24 +249,27 @@ function post_tags_meta_box($post, $box) {
$taxonomy = get_taxonomy($tax_name);
if ( !current_user_can($taxonomy->assign_cap) ) // @todo: Display the terms, do not edit.
return;
$helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('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_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud : __('Choose from the most used tags in %s');
?>
<div class="tagsdiv" id="<?php echo $tax_name; ?>">
<div class="jaxtag">
<div class="nojs-tags hide-if-js">
<p><?php _e('Add or remove tags'); ?></p>
<p><?php echo $help_nojs; ?></p>
<textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
<div class="ajaxtag hide-if-no-js">
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
<div class="taghint"><?php _e('Add new tag'); ?></div>
<div class="taghint"><?php echo $help_hint; ?></div>
<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" />
</div></div>
<p class="howto"><?php echo $helps; ?></p>
<div class="tagchecklist"></div>
</div>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( $help_cloud, $box['title'] ); ?></a></p>
<?php
}