| @@ -9,8 +9,9 @@ | ||
| 9 | 9 | * @since 1.0.0 |
| 10 | 10 | * @version 1.8.1.14 |
| 11 | 11 | * @version 1.8.3 |
| 12 | 12 | * @version 1.8.8.6 |
| 13 | + * @version 1.8.12.1 Add charitable_campaign_description_limit filter. | |
| 13 | 14 | */ |
| 14 | 15 | |
| 15 | 16 | // Exit if accessed directly. |
| 16 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -20,8 +21,19 @@ | ||
| 20 | 21 | // Prior the description output as $view_args['campaign']->description but since 1.7.0.4 as visual editor can add html. |
| 21 | 22 | $charitable_campaign = isset( $view_args['campaign'] ) ? $view_args['campaign'] : false; |
| 22 | 23 | $charitable_description = isset( $view_args['description'] ) ? $view_args['description'] : false; |
| 23 | 24 | $charitable_description_limit = isset( $view_args['view_args']['description_limit'] ) ? $view_args['view_args']['description_limit'] : 100; |
| 25 | + | |
| 26 | +/** | |
| 27 | + * Filter the number of words the campaign description is trimmed to on the campaign page. | |
| 28 | + * | |
| 29 | + * @since 1.8.12.1 | |
| 30 | + * | |
| 31 | + * @param int $charitable_description_limit Number of words to keep. | |
| 32 | + * @param Charitable_Campaign|false $charitable_campaign The campaign object (may be false). | |
| 33 | + * @param array $view_args The template view arguments. | |
| 34 | + */ | |
| 35 | +$charitable_description_limit = (int) apply_filters( 'charitable_campaign_description_limit', $charitable_description_limit, $charitable_campaign, $view_args ); | |
| 24 | 36 | |
| 25 | 37 | if ( $charitable_description === false ) { |
| 26 | 38 | $charitable_description = isset( $view_args['campaign'] ) && ! empty( $view_args['campaign']->description ) ? $view_args['campaign']->description : $charitable_description; |
| 27 | 39 | // If there still is no description, try to get it from the meta data (legacy). |