Making WordPress.org

Changeset 5196


Ignore:
Timestamp:
03/29/2017 05:11:30 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Adjust exerpt length by locale

Allows for a longer excerpt in letter count locales.

Props SergeyBiryukov.
Fixes #2628.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r5195 r5196  
    155155function excerpt_length( $excerpt ) {
    156156    if ( is_home() || is_archive() ) {
    157         $excerpt = wp_trim_words( $excerpt, 15 );
     157        /*
     158         * translators: If your word count is based on single characters (e.g. East Asian characters),
     159         * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
     160         * Do not translate into your own language.
     161         */
     162        if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 ) {
     163            // Use the default limit of 55 characters for East Asian locales.
     164            $excerpt = wp_trim_words( $excerpt );
     165        } else {
     166            // Limit the excerpt to 15 words for other locales.
     167            $excerpt = wp_trim_words( $excerpt, 15 );
     168        }
    158169    }
    159170
Note: See TracChangeset for help on using the changeset viewer.