Version Description
- Fixed: Truncate headline.
Download this release
Release Info
Developer | hishaman |
Plugin | Schema |
Version | 1.7.8.7 |
Comparing to | |
See all releases |
Code changes from version 1.7.8.5 to 1.7.8.7
- includes/deprecated-functions.php +17 -0
- includes/json/schema-output.php +4 -1
- includes/misc-functions.php +32 -0
- readme.txt +7 -1
- schema.php +2 -2
includes/deprecated-functions.php
CHANGED
@@ -39,3 +39,20 @@ function schema_wp_first_post_date( $format = 'Y-m-d' ) {
|
|
39 |
|
40 |
return $output;
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
return $output;
|
41 |
}
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Truncate a string of content to 110 characters, respecting full words.
|
46 |
+
*
|
47 |
+
* @since 1.7.1
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
function schema_wp_get_truncate_to_word_deprecated( $string, $limit = 110, $end = '...' ) {
|
51 |
+
|
52 |
+
$limit = apply_filters( 'schema_wp_truncate_to_word_limit', $limit );
|
53 |
+
$limit = $limit - strlen($end); // Take into account $end string into the limit
|
54 |
+
$string = substr($string, 0, $limit);
|
55 |
+
$string = substr($string, 0, strrpos($string, ' ')) . $end;
|
56 |
+
|
57 |
+
return $string;
|
58 |
+
}
|
includes/json/schema-output.php
CHANGED
@@ -250,10 +250,13 @@ function schema_wp_get_schema_json_prepare( $post_id = null ) {
|
|
250 |
// Get publisher array
|
251 |
$publisher = schema_wp_get_publisher_array();
|
252 |
|
|
|
|
|
|
|
253 |
//
|
254 |
// Putting all together
|
255 |
//
|
256 |
-
$json["headline"] = apply_filters ( 'schema_wp_filter_headline', $
|
257 |
|
258 |
$json['description'] = $description;
|
259 |
$json['permalink'] = $permalink;
|
250 |
// Get publisher array
|
251 |
$publisher = schema_wp_get_publisher_array();
|
252 |
|
253 |
+
// Truncate headline
|
254 |
+
$headline = schema_wp_get_truncate_to_word( $content_post->post_title );
|
255 |
+
|
256 |
//
|
257 |
// Putting all together
|
258 |
//
|
259 |
+
$json["headline"] = apply_filters ( 'schema_wp_filter_headline', $headline );
|
260 |
|
261 |
$json['description'] = $description;
|
262 |
$json['permalink'] = $permalink;
|
includes/misc-functions.php
CHANGED
@@ -947,3 +947,35 @@ function schema_wp_is_blog() {
|
|
947 |
|
948 |
return false;
|
949 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
|
948 |
return false;
|
949 |
}
|
950 |
+
|
951 |
+
/**
|
952 |
+
* Truncate a string of content to 110 characters, respecting full words.
|
953 |
+
*
|
954 |
+
* @since 1.7.1
|
955 |
+
* @return string
|
956 |
+
*/
|
957 |
+
function schema_wp_get_truncate_to_word( $string, $limit = 110, $end = '...' ) {
|
958 |
+
|
959 |
+
$limit = apply_filters( 'schema_wp_truncate_to_word_limit', $limit );
|
960 |
+
|
961 |
+
if (strlen($string) > $limit || $string == '') {
|
962 |
+
$words = preg_split('/\s/', $string);
|
963 |
+
$output = '';
|
964 |
+
$i = 0;
|
965 |
+
while (1) {
|
966 |
+
$length = strlen($output)+strlen($words[$i]);
|
967 |
+
if ($length > $limit) {
|
968 |
+
break;
|
969 |
+
}
|
970 |
+
else {
|
971 |
+
$output .= " " . $words[$i];
|
972 |
+
++$i;
|
973 |
+
}
|
974 |
+
}
|
975 |
+
$output .= $end;
|
976 |
+
}
|
977 |
+
else {
|
978 |
+
$output = $string;
|
979 |
+
}
|
980 |
+
return $output;
|
981 |
+
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: schema, schema.org, rich snippets, structured data, json-ld, json, google,
|
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.6.1
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 1.7.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -223,6 +223,12 @@ Yes, Schema plugin will detect AMP plugin and output a more complete and valid s
|
|
223 |
|
224 |
== Changelog ==
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
= 1.7.8.5 =
|
227 |
* Fixed: Use full headline instead of truncated version.
|
228 |
* Update: Pumped tested WordPress version to 5.6.1 release.
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.6.1
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 1.7.8.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
223 |
|
224 |
== Changelog ==
|
225 |
|
226 |
+
= 1.7.8.7 =
|
227 |
+
* Fixed: Truncate headline.
|
228 |
+
|
229 |
+
= 1.7.8.6 =
|
230 |
+
* Fixed: Revert to truncate headline to 110 characters, avoid markup error.
|
231 |
+
|
232 |
= 1.7.8.5 =
|
233 |
* Fixed: Use full headline instead of truncated version.
|
234 |
* Update: Pumped tested WordPress version to 5.6.1 release.
|
schema.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: The next generation of Structured Data.
|
6 |
* Author: Hesham
|
7 |
* Author URI: http://zebida.com
|
8 |
-
* Version: 1.7.8.
|
9 |
* Text Domain: schema-wp
|
10 |
* Domain Path: /languages
|
11 |
* License: GPLv2 or later
|
@@ -52,7 +52,7 @@ final class Schema_WP {
|
|
52 |
*
|
53 |
* @since 1.0
|
54 |
*/
|
55 |
-
private $version = '1.7.8.
|
56 |
|
57 |
/**
|
58 |
* The settings instance variable
|
5 |
* Description: The next generation of Structured Data.
|
6 |
* Author: Hesham
|
7 |
* Author URI: http://zebida.com
|
8 |
+
* Version: 1.7.8.7
|
9 |
* Text Domain: schema-wp
|
10 |
* Domain Path: /languages
|
11 |
* License: GPLv2 or later
|
52 |
*
|
53 |
* @since 1.0
|
54 |
*/
|
55 |
+
private $version = '1.7.8.7';
|
56 |
|
57 |
/**
|
58 |
* The settings instance variable
|