title: Remove 3 dots from the end of excerpt in wordpress
body: <p>I have this front page showing three texts, but it all ends with "..." which is okay all other places than this particular place. The post type for these three texts is services, why I have modified the code as below.</p>
  
  <pre><code>// The excerpt based on words
  /* Original disabled by Kenn Nielsen
  function my_string_limit_words($string, $word_limit)
  {
    $words = explode(' ', $string, ($word_limit + 1));
    if(count($words) &gt; $word_limit)
    array_pop($words);
    return implode(' ', $words).'...';
  }
  */
  
  // Created if statement to remove dots from services on frontpage 
  
  if (post_type_exists('services') ) {
      function my_string_limit_words($string, $word_limit) {
          $words = explode(' ', $string, ($word_limit + 1));
          if(count($words) &gt; $word_limit)
          array_pop($words);
          return implode(' ', $words).'';
      }
  } else {
      function my_string_limit_words($string, $word_limit) {
          $words = explode(' ', $string, ($word_limit + 1));
          if(count($words) &gt; $word_limit)
          array_pop($words);
          return implode(' ', $words).'...';
      }
  }
  </code></pre>
  
  <p>Unfortunately this is not working as expected. Is there something I'm missing? 
  I'm sure this could be done in shorter code, but I choose the quick way.</p>
  
  <p>Best, 
  Kenn </p>
  
  <p>A work-around:</p>
  
  <p>Fixed it with the easiest solution without changing the theme-function.php and the way it change the excerpt to show three dots if wordcount has been given.</p>
  
  <p>In the widget, the code used for displaying the content is:</p>
  
  <pre><code>        &lt;div class="post_content"&gt;
          &lt;?php if ( $instance['excerpt'] ) : ?&gt;
            &lt;?php if($limittext=="" || $limittext==0){ ?&gt;
                &lt;?php if ( $instance['excerpt_as_link'] ) : ?&gt;
                  &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;
                &lt;?php endif; ?&gt;
              &lt;?php the_excerpt(); ?&gt;
                &lt;?php if ( $instance['excerpt_as_link'] ) : ?&gt;
                  &lt;/a&gt;
                &lt;?php endif; ?&gt;
            &lt;?php }else{ ?&gt;
                &lt;?php if ( $instance['excerpt_as_link'] ) : ?&gt;
                  &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;
                &lt;?php endif; ?&gt;
              &lt;?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext);?&gt;
                &lt;?php if ( $instance['excerpt_as_link'] ) : ?&gt;
                  &lt;/a&gt;
                &lt;?php endif; ?&gt;
            &lt;?php } ?&gt;
          &lt;?php endif; ?&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>The way was to echo without the function, so</p>
  
  <pre><code>&lt;?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,$limittext);?&gt;
  </code></pre>
  
  <p>will be</p>
  
  <pre><code>&lt;?php $excerpt = get_the_excerpt(); echo $excerpt;?&gt;
  </code></pre>
  
  <p>And this solved the issue/request.</p>