pmpro_text_limit

The Paid Memberships Pro pmpro text limit function.

Description

pmpro_text_limit( $text, $limit, (string) $finish = '…' ); 

Parameters (3)

0. $text
The text.
1. $limit
The limit.
2. $finish — Optional. (string) => '…'
The finish.

Usage

  1. if ( !function_exists( 'pmpro_text_limit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4. // The text. 
  5. $text = null; 
  6.  
  7. // The limit. 
  8. $limit = null; 
  9.  
  10. // The finish. 
  11. $finish = '…'; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = pmpro_text_limit($text, $limit, $finish); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.php  
  1. function pmpro_text_limit( $text, $limit, $finish = '…') 
  2. if( strlen( $text ) > $limit ) { 
  3. $text = substr( $text, 0, $limit ); 
  4. $text = substr( $text, 0, - ( strlen( strrchr( $text, ' ') ) ) ); 
  5. $text .= $finish; 
  6. return $text;