Title: thail's Replies | WordPress.org

---

# thail

  [  ](https://wordpress.org/support/users/thail/)

 *   [Profile](https://wordpress.org/support/users/thail/)
 *   [Topics Started](https://wordpress.org/support/users/thail/topics/)
 *   [Replies Created](https://wordpress.org/support/users/thail/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/thail/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/thail/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/thail/engagements/)
 *   [Favorites](https://wordpress.org/support/users/thail/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Featured Post Widget] unable to return three dots at the end of excerpt.](https://wordpress.org/support/topic/unable-to-return-three-dots-at-the-end-of-excerpt/)
 *  Thread Starter [thail](https://wordpress.org/support/users/thail/)
 * (@thail)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/unable-to-return-three-dots-at-the-end-of-excerpt/#post-5015889)
 *     ```
       <?php
   
       /**
        *
        * Class A5 Excerpt
        *
        * @ A5 Plugin Framework
        * Version: 1.0 beta
        *
        * Gets the excerpt of a post according to some parameters
        *
        * standard parameters: offset(=0), usertext, excerpt, count
        * additional parameters: class(classname), filter(boolean), shortcode(boolean), format(boolean), readmore_link(boolean),
        * readmore_text(string)
        *
        */
   
       class A5_Excerpt {
   
       	public static function text($args) {
   
       		extract($args);
   
       		$offset = (isset($offset)) ? $offset : 0;
   
       		$class = (!empty($class)) ? ' class ="'.$class.'"' : '';
   
       		$filter = (isset($filter)) ? $filter : false;
   
       		$shortcode = (isset($shortcode)) ? $shortcode : false;
   
       		$format = (isset($format)) ? $format : false;
   
       		if (!empty($usertext)) :
   
       			$output = $usertext;
   
       		else: 
   
       			if (!empty($excerpt)) :
   
       				$output = $excerpt;
   
       			else :
   
       				$excerpt_base = (empty($shortcode)) ? preg_replace('/\[caption(.*?)\[\/caption\]/', '', $content) : strip_shortcodes($content);
   
       				$text = (empty($format)) ? strip_tags(trim(preg_replace('/\s\s+/', ' ', str_replace(array("\r\n", "\n", "\r", "&nbsp;"), ' ', $excerpt_base)))) : preg_replace('#<img(.*?)/>#', '', $excerpt_base);
   
       				$text = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $text);
   
       				$length = (isset($count)) ? $count : 15;
       				$dots = 'hello';
       				$style = (isset($type)) ? $type : 'sentences';
   
       				switch ($style) :
   
       					case 'words' :
   
       						$short = array_slice(explode(' ', $text), $offset, $length);
   
       						$output = trim(implode(' ', $short));
   
       						break;
   
       					case 'sentences' :
       						/*
       						$short = array_slice(preg_split("/([\t.!?:]+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE), $offset*2, $length*2);
   
       						$output = trim(implode($short)); */
       						$short = array_slice(explode(' ', $text), $offset, $length);
       						$output = trim(implode(' ', $short));
       								$args = array(
       								'readmore' => true,
       								'rmtext' => '...'
       )
   
       $excerpt = A5_Excerpt::text($args);
       						break;
   
       					case 'letters' :
   
       						$output = substr($text, $offset, $length);
   
       						break;
   
       					default :
   
       						$output = $text;
   
       				endswitch;
   
       			endif;
   
       		endif;
   
       		if (!empty($linespace)) :
   
       			$short=preg_split("/([\t.!?:]+)/", $output, -1, PREG_SPLIT_DELIM_CAPTURE);
   
       			$short[count($short)] = '';
   
       			foreach ($short as $key => $pieces) :
   
       				if (!($key % 2) && $key < (count($short)-1)) :
   
       					$tmpex[] = implode(array($short[$key], $short[$key+1]));
   
       				endif;
   
       			endforeach;
   
       			if (isset($tmpex)) $output = trim(implode('<br /><br />', $tmpex));
   
       		endif;
   
       		if (!empty($readmore)) $output.=' <a href="'.$link.'" title="'.$title.'"'.$class.'>'.$rmtext.'</a>';
   
       		$output = ($filter === true) ? apply_filters('the_excerpt', $output) : $output;
   
       		return $output;
   
       	}
   
       } // A5_Excerpt
   
       ?>
       ```
   
 * This throws an error! Parse error: syntax error, unexpected ‘$excerpt’ (T_VARIABLE.
 * I’m kinda new to the php. Can you please guide me exactly where to put that piece
   of code . It will be appreciated. 🙂

Viewing 1 replies (of 1 total)