skt_photo_world_string_limit_words

Set the content width based on the theme's design and stylesheet.

Description

skt_photo_world_string_limit_words( $string, $word_limit ); 

Parameters (2)

0. $string
The string.
1. $word_limit
The word limit.

Usage

  1. if ( !function_exists( 'skt_photo_world_string_limit_words' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The string. 
  5. $string = null; 
  6.  
  7. // The word limit. 
  8. $word_limit = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = skt_photo_world_string_limit_words($string, $word_limit); 
  12.  

Defined (1)

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

/functions.php  
  1. function skt_photo_world_string_limit_words($string, $word_limit) { 
  2. $words = explode(' ', $string, ($word_limit + 1)); 
  3. if(count($words) > $word_limit) 
  4. array_pop($words); 
  5. return implode(' ', $words);