Plugin Directory

Changeset 727531


Ignore:
Timestamp:
06/17/2013 04:18:53 PM (13 years ago)
Author:
jayarjo
Message:

Truncate description on listing pages.

Location:
rich-tax-description-editor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rich-tax-description-editor/trunk/main.php

    r489040 r727531  
    6868        return $description;   
    6969    }
     70
     71    // truncate term description
     72    function f_10_3__get_terms($terms, $taxonomies, $args)
     73    {
     74        global $pagenow;
     75        if (is_admin() && $pagenow == 'edit-tags.php' && !isset($_REQUEST['action'])) { // detect taxonomy list page
     76            foreach ($terms as &$term) {
     77                $term->description = $this->to_plain_text($term->description);
     78            }
     79        }
     80        return $terms; 
     81    }
     82   
     83    private function to_plain_text($text)
     84    {       
     85        $text = strip_shortcodes( $text );
     86        $text = apply_filters('the_content', $text);
     87        $text = str_replace(']]>', ']]>', $text);
     88        $text = wp_trim_words( $text, 12, '...' );
     89        return $text;
     90    }
    7091}
    7192
  • rich-tax-description-editor/trunk/readme.txt

    r489040 r727531  
    3737= 1.0 =
    3838Initial release.
     39
     40= 1.1 =
     41Fix undefined notices.
     42Truncate description on listing pages.
Note: See TracChangeset for help on using the changeset viewer.