Skip to:
Content

BuddyPress.org

Changeset 11280


Ignore:
Timestamp:
12/08/2016 02:38:06 AM (7 years ago)
Author:
boonebgorges
Message:

Introduce bp_activity_excerpt_length().

This function provides a centralized filter for controlling
the length of activity excerpts generated throughout BP.

Props sanket.parmar.
Fixes #7321.

Location:
trunk/src/bp-activity
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-filters.php

    r11256 r11280  
    451451    $append_text    = apply_filters( 'bp_activity_excerpt_append_text', __( '[Read more]', 'buddypress' ) );
    452452
    453     /**
    454      * Filters the excerpt length for the activity excerpt.
    455      *
    456      * @since 1.5.0
    457      *
    458      * @param int $value Number indicating how many words to trim the excerpt down to.
    459      */
    460     $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
     453    $excerpt_length = bp_activity_get_excerpt_length();
    461454
    462455    $args = wp_parse_args( $args, array( 'ending' => __( '…', 'buddypress' ) ) );
  • trunk/src/bp-activity/bp-activity-functions.php

    r11279 r11280  
    31143114
    31153115/**
     3116 * Gets the excerpt length for activity items.
     3117 *
     3118 * @since 2.8.0
     3119 *
     3120 * @return int Character length for activity excerpts.
     3121 */
     3122function bp_activity_get_excerpt_length() {
     3123    /**
     3124     * Filters the excerpt length for the activity excerpt.
     3125     *
     3126     * @since 1.5.0
     3127     *
     3128     * @param int Character length for activity excerpts.
     3129     */
     3130    return (int) apply_filters( 'bp_activity_excerpt_length', 358 );
     3131}
     3132
     3133/**
    31163134 * Create a rich summary of an activity item for the activity stream.
    31173135 *
  • trunk/src/bp-activity/bp-activity-template.php

    r11091 r11280  
    26982698         * @param int    $user_id ID of the queried user.
    26992699         */
    2700         $latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ), $user_id );
     2700        $latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], bp_activity_get_excerpt_length() ) ) ), $user_id );
    27012701
    27022702        $latest_update = sprintf(
Note: See TracChangeset for help on using the changeset viewer.