Content Views – Post Grid & List for WordPress - Version 1.6.8.1

Version Description

  • Bug fixed: Excerpt length
Download this release

Release Info

Developer PT Guy
Plugin Icon 128x128 Content Views – Post Grid & List for WordPress
Version 1.6.8.1
Comparing to
See all releases

Code changes from version 1.6.8 to 1.6.8.1

Files changed (3) hide show
  1. README.txt +4 -2
  2. content-views.php +2 -2
  3. includes/functions.php +4 -31
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
  Tested up to: 4.3.1
7
- Stable tag: 1.6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -174,10 +174,12 @@ function my_move_bootstrap( $args ) {
174
 
175
  == Changelog ==
176
 
 
 
 
177
  = 1.6.8 =
178
  * Improvement: More elegant UI for Fields settings
179
  * Improvement: Performance improvement by merging filers
180
- * Improvement: Support HTML tags in excerpt better: get correct excerpt length, get text/content of allowed tags
181
  * Bug fixed: Slug of term on Non-Latin languages does not show correctly
182
  * Bug fixed: Fix Javascript error "Uncaught query function not defined for Select2 undefined"
183
  * Update: Add filter "terms_include_this" to exclude terms from meta-fields output
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
  Tested up to: 4.3.1
7
+ Stable tag: 1.6.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
174
 
175
  == Changelog ==
176
 
177
+ = 1.6.8.1 =
178
+ * Bug fixed: Excerpt length
179
+
180
  = 1.6.8 =
181
  * Improvement: More elegant UI for Fields settings
182
  * Improvement: Performance improvement by merging filers
 
183
  * Bug fixed: Slug of term on Non-Latin languages does not show correctly
184
  * Bug fixed: Fix Javascript error "Uncaught query function not defined for Select2 undefined"
185
  * Update: Add filter "terms_include_this" to exclude terms from meta-fields output
content-views.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
- * Version: 1.6.8
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( !defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.6.8' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
+ * Version: 1.6.8.1
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.6.8.1' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
includes/functions.php CHANGED
@@ -248,37 +248,10 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
248
  * @return string
249
  */
250
  static function trim_words( $result, $num_words ) {
251
- // Skip HTML tag name & properties, don't skip tag text
252
- $text_result = preg_split( '/<[a-z\/]+[^>]+>/', $result, NULL, PREG_SPLIT_OFFSET_CAPTURE );
253
- $words_length = $split_index = 0;
254
- foreach ( $text_result as $part ) {
255
- $substr = isset( $part[ 0 ] ) ? $part[ 0 ] : '';
256
- $substr_index = isset( $part[ 1 ] ) ? $part[ 1 ] : 0;
257
- if ( !empty( $substr ) ) {
258
- $words_in_str = str_word_count( $substr, 2 );
259
- $words_length += count( $words_in_str );
260
-
261
- if ( $words_length > $num_words ) {
262
- $words_count_to_get = count( $words_in_str ) - ($words_length - $num_words);
263
- if ( $words_count_to_get ) {
264
- $words_to_get = array_slice( $words_in_str, 0, $words_count_to_get, true );
265
- end( $words_to_get );
266
- $last_word_idx = key( $words_to_get );
267
- $split_index = $substr_index + $last_word_idx + strlen( $words_to_get[ $last_word_idx ] ) + 1;
268
- } else {
269
- $split_index = $substr_index;
270
- }
271
-
272
- break;
273
- }
274
- }
275
- }
276
-
277
- if ( $split_index > 0 ) {
278
- $result = substr( $result, 0, $split_index );
279
- // Remove start of HTML tag at end of string
280
- $result = preg_replace( '/<[a-z\/]+[^>]+>$/', '', $result );
281
- }
282
 
283
  // Changes double line-breaks in the text into HTML paragraphs (<p>, <br>)
284
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
248
  * @return string
249
  */
250
  static function trim_words( $result, $num_words ) {
251
+ // Split words
252
+ $array = preg_split( "/[\n\r\t ]+/", $result, $num_words + 1, PREG_SPLIT_NO_EMPTY );
253
+ array_splice( $array, $num_words );
254
+ $result = implode( ' ', $array );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  // Changes double line-breaks in the text into HTML paragraphs (<p>, <br>)
257
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );