Title: Vernon Grant's Replies | WordPress.org

---

# Vernon Grant

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

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

 Search replies:

## Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Post Images Distorted/Skewed/Stretched](https://wordpress.org/support/topic/post-images-distortedskewedstretched/)
 *  [Vernon Grant](https://wordpress.org/support/users/vernonrant/)
 * (@vernonrant)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/post-images-distortedskewedstretched/#post-7717388)
 * There’s a min-height property active on your themes images. If you know how to
   edit your theme’s main CSS file then simply just override the active property
   with the following.
 *     ```
       .vw-post-box-thumbnail img {
           min-height: auto !important;
           height: auto !important;
       }
       ```
   
 * It also seems that you are using a plugin that speeds up your theme. I would 
   suggest that you disable it if the above CSS doesn’t work as it combines your
   CSS files into one large minified file. This might affect the Cascading effect
   of CSS (order of inclusion).
 * Thanks
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [My "is_archive" seems to be not working right](https://wordpress.org/support/topic/my-is_archive-seems-to-be-not-working-right/)
 *  [Vernon Grant](https://wordpress.org/support/users/vernonrant/)
 * (@vernonrant)
 * [10 years ago](https://wordpress.org/support/topic/my-is_archive-seems-to-be-not-working-right/#post-7417015)
 * Hi David.
 * I placed your code into a single PHP file. After that I included the file into
   the loop of the following files: index.php, archive.php and search.php I also
   places a unique echo statement in each condition and got back the expected results.
   Your code seems to work just fine for me.
 * Thanks, Vernon
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [My "is_archive" seems to be not working right](https://wordpress.org/support/topic/my-is_archive-seems-to-be-not-working-right/)
 *  [Vernon Grant](https://wordpress.org/support/users/vernonrant/)
 * (@vernonrant)
 * [10 years ago](https://wordpress.org/support/topic/my-is_archive-seems-to-be-not-working-right/#post-7417008)
 * Hi David,
 * I think I might have miss read your question lol. So your using this peace of
   code as an include file to run across your themes files, archive.php, search.
   php… Let me take a look and get back to you.
 * Thanks, Vernon
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[Hueman] Excerpts become full of content](https://wordpress.org/support/topic/excerpts-become-full-of-content/)
 *  [Vernon Grant](https://wordpress.org/support/users/vernonrant/)
 * (@vernonrant)
 * [10 years ago](https://wordpress.org/support/topic/excerpts-become-full-of-content/page/2/#post-6460344)
 * Cool, I’m glad I could help.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[Hueman] Excerpts become full of content](https://wordpress.org/support/topic/excerpts-become-full-of-content/)
 *  [Vernon Grant](https://wordpress.org/support/users/vernonrant/)
 * (@vernonrant)
 * [10 years ago](https://wordpress.org/support/topic/excerpts-become-full-of-content/#post-6460341)
 * Hi, Kreen
 * I have had the same problem before and I’m afraid at this point there’s no perfect
   solution especially when having a bilingual type of website where different character
   types are mixed. I could create one but It would take a lot of time.
 * Here is a simple filter to fix this problem. The First thing is to detect if 
   the post excerpt is in fact written in Chinese and if so we want to use a couple
   of multi-byte string function provided by PHP. Keep in mind the filter will not
   effect English posts.
 * The first function is **mb_strlen** and we will use this to check if the excerpt
   exceeds our limit and if so we would like to add a decorator to the end of the
   string. The second function is **mb_substr** and it will limit the actual string
   to the limit we defined in the top of the function.
 * Below is an example filter, feel free to give it a try. Keep in mind your theme
   needs to use the get_the_excerpt() method.
 *     ```
       /**
        * Filters the excerpt to limit Chinese strings properly.
        *
        * @return string The new limited excerpt
        */
       function filter_chinese_excerpt($excerpt){
   
           // Chinese excerpt limit. Set your limit here!
           $limit = 130;
   
           // Ending decoration. ([...])
           $decoration = '[…]';
   
           // If Chinese.
           if(preg_match("/\p{Han}+/u", $excerpt)){
   
               // If longer then limit add decoration to end of string.
               // Also returns the string
               if(mb_strlen($excerpt, 'UTF-8') >= $limit){
                    return mb_substr($excerpt, 0, $limit, 'UTF-8') . $decoration;
                }else{
                    return mb_substr($excerpt, 0, $limit, 'UTF-8');
                }
           }
           return $excerpt;
       }
       add_filter('get_the_excerpt', 'filter_chinese_excerpt');
       ```
   
 * Thanks, Vernon

Viewing 5 replies - 1 through 5 (of 5 total)