Making WordPress.org


Ignore:
Timestamp:
12/04/2016 07:03:40 PM (7 years ago)
Author:
obenland
Message:

Plugin Directory: Reduce excerpt length to ensure same height for plugin cards.

Fixes #2285.

File:
1 edited

Legend:

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

    r4410 r4473  
    142142
    143143/**
     144 * Shorten excerpt length on index pages, so plugins cards are all the same height.
     145 *
     146 * @param string $excerpt The excerpt.
     147 * @return string
     148 */
     149function excerpt_length( $excerpt ) {
     150    if ( is_home() || is_archive() ) {
     151        $excerpt = wp_trim_words( $excerpt, 15 );
     152    }
     153
     154    return $excerpt;
     155}
     156add_filter( 'get_the_excerpt', __NAMESPACE__ . '\excerpt_length' );
     157
     158/**
    144159 * Adds hreflang link attributes to plugin pages.
    145160 *
Note: See TracChangeset for help on using the changeset viewer.