Rich Text Tags - Version 1.3.1

Version Description

  • Shortened term description in the Edit page so the table doesn't get too long (good idea, DL). You can modify the length with the term_excerpt_length filter.
Download this release

Release Info

Developer katzwebdesign
Plugin Icon 128x128 Rich Text Tags
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

Files changed (2) hide show
  1. readme.txt +3 -0
  2. rich-text-tags.php +35 -1
readme.txt CHANGED
@@ -35,6 +35,9 @@ Use the PHP functions `tag_description()` and `category_description()` in your t
35
 
36
  == Upgrade Notice ==
37
 
 
 
 
38
  = 1.3 =
39
  * Added support for NextGen Gallery
40
  * Improved Media Buttons support by gathering up stray link buttons
35
 
36
  == Upgrade Notice ==
37
 
38
+ = 1.3.1 =
39
+ * Shortened term description in the Edit page so the table doesn't get too long (good idea, <a href="http://uniondesign.ca/" rel="nofollow">DL</a>). You can modify the length with the `term_excerpt_length` <a href="http://codex.wordpress.org/Plugin_API#Filters" rel="nofollow">filter</a>.
40
+
41
  = 1.3 =
42
  * Added support for NextGen Gallery
43
  * Improved Media Buttons support by gathering up stray link buttons
rich-text-tags.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Rich Text Tags, Categories, and Taxonomies
4
  Plugin URI: http://www.seodenver.com/rich-text-tags/
5
  Description: This plugin offers rich text editing capabilities for descriptions of tags, categories, and taxonomies.
6
  Author: Katz Web Services, Inc.
7
- Version: 1.3
8
  Author URI: http://www.katzwebservices.com
9
  */
10
  /*
@@ -68,7 +68,41 @@ function kws_rich_text_tags() {
68
 
69
  add_action('init','kws_rt_taxonomy_load_mce');
70
  add_action('wp_print_scripts','kws_rt_taxonomy_scripts');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
 
 
 
 
 
 
 
 
 
72
  if($GLOBALS['pagenow'] == 'edit-tags.php' && $_REQUEST['action'] == 'edit') {
73
  if(isset($_REQUEST['taxonomy'])) {
74
  add_action(esc_attr($_REQUEST['taxonomy']).'_edit_form_fields', 'kws_show_media_upload');
4
  Plugin URI: http://www.seodenver.com/rich-text-tags/
5
  Description: This plugin offers rich text editing capabilities for descriptions of tags, categories, and taxonomies.
6
  Author: Katz Web Services, Inc.
7
+ Version: 1.3.1
8
  Author URI: http://www.katzwebservices.com
9
  */
10
  /*
68
 
69
  add_action('init','kws_rt_taxonomy_load_mce');
70
  add_action('wp_print_scripts','kws_rt_taxonomy_scripts');
71
+ } elseif(
72
+ $GLOBALS['pagenow'] == 'edit-tags.php' ||
73
+ $GLOBALS['pagenow'] == 'categories.php'
74
+ ) {
75
+ add_filter('get_terms', 'kws_shorten_term_description');
76
+ }
77
+
78
+ function kws_wp_trim_excerpt($text) {
79
+ $raw_excerpt = $text;
80
+
81
+ # $text = strip_shortcodes( $text );
82
+ # $text = apply_filters('the_content', $text);
83
+ $text = str_replace(']]>', ']]&gt;', $text);
84
+ # $text = strip_tags($text);
85
+ $excerpt_length = apply_filters('term_excerpt_length', 40);
86
+ $excerpt_more = ' ' . '[...]';
87
+ $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
88
+ if ( count($words) > $excerpt_length ) {
89
+ array_pop($words);
90
+ $text = implode(' ', $words);
91
+ $text = $text . $excerpt_more;
92
+ } else {
93
+ $text = implode(' ', $words);
94
+ }
95
+ return apply_filters('wp_trim_term_excerpt', force_balance_tags($text), $raw_excerpt);
96
  }
97
+
98
+ function kws_shorten_term_description($terms, $taxonomies = null, $args = array()) {
99
+ foreach($terms as $key=>$term) {
100
+ $term->description = kws_wp_trim_excerpt($term->description);
101
+ }
102
+ return $terms;
103
+ }
104
+
105
+
106
  if($GLOBALS['pagenow'] == 'edit-tags.php' && $_REQUEST['action'] == 'edit') {
107
  if(isset($_REQUEST['taxonomy'])) {
108
  add_action(esc_attr($_REQUEST['taxonomy']).'_edit_form_fields', 'kws_show_media_upload');