Пример #1
0
 public static function getTheExcerpt($postID, $len = 120, $extra = '...')
 {
     static $cache = [];
     if (isset($cache[$postID])) {
         return $cache[$postID];
     }
     $post = static::getPost($postID);
     $excerpt = \get_the_excerpt($postID);
     if ($excerpt) {
         $cache[$postID] = Functions::subStr($excerpt, $len, $extra);
     } else {
         $cache[$postID] = Functions::subStr(str_replace("\n", '', strip_tags($post->post_content)), $len, $extra);
     }
     return $cache[$postID];
 }