Version Description
- Fix: CSS for admin bar menu item.
- Tweak: Added premium extensions to extension page.
- Update: Pumped tested WordPress version to 5.2.3 release.
Download this release
Release Info
Developer | hishaman |
Plugin | Schema |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5 to 1.7.6
- includes/admin/admin-bar-menu.php +1 -1
- includes/admin/extensions.php +6 -2
- includes/json/knowledge-graph.php +20 -9
- includes/json/taxonomy.php +1 -1
- includes/misc-functions.php +59 -2
- readme.txt +10 -4
- schema.php +2 -2
includes/admin/admin-bar-menu.php
CHANGED
@@ -63,7 +63,7 @@ function schema_wp_admin_bar_styles() {
|
|
63 |
<style type="text/css">
|
64 |
/* admin bar */
|
65 |
.schema_google_developers a {
|
66 |
-
padding-left:
|
67 |
background: transparent url('<?php echo SCHEMAWP_PLUGIN_URL; ?>assets/images/admin-bar/google-developers.png') 8px 50% no-repeat !important;
|
68 |
}
|
69 |
.schema_google_developers a:hover {
|
63 |
<style type="text/css">
|
64 |
/* admin bar */
|
65 |
.schema_google_developers a {
|
66 |
+
padding-left:20px !important;
|
67 |
background: transparent url('<?php echo SCHEMAWP_PLUGIN_URL; ?>assets/images/admin-bar/google-developers.png') 8px 50% no-repeat !important;
|
68 |
}
|
69 |
.schema_google_developers a:hover {
|
includes/admin/extensions.php
CHANGED
@@ -93,7 +93,10 @@ function schema_wp_extensions_get_rest( $tab = 'premium' ) {
|
|
93 |
$extensions = json_decode( wp_remote_retrieve_body( $api_response ), true );
|
94 |
|
95 |
if ( $extensions && ! empty($extensions['products'] ) ) {
|
96 |
-
|
|
|
|
|
|
|
97 |
foreach ( $extensions['products'] as $key => $extension ) {
|
98 |
|
99 |
// get extension info
|
@@ -106,7 +109,8 @@ function schema_wp_extensions_get_rest( $tab = 'premium' ) {
|
|
106 |
if ( $tab === 'premium' ) {
|
107 |
// exclude if not in this category
|
108 |
$category = isset($info['category'][0]['slug']) ? $info['category'][0]['slug'] : '';
|
109 |
-
if ( $category != $tab && $info['slug'] != 'schema-premium' ) continue;
|
|
|
110 |
} else {
|
111 |
// exclude if not in this category
|
112 |
$category = isset($info['category'][0]['slug']) ? $info['category'][0]['slug'] : '';
|
93 |
$extensions = json_decode( wp_remote_retrieve_body( $api_response ), true );
|
94 |
|
95 |
if ( $extensions && ! empty($extensions['products'] ) ) {
|
96 |
+
|
97 |
+
// debug
|
98 |
+
//echo'<pre>';print_r($extensions['products'] );echo'</pre>';
|
99 |
+
|
100 |
foreach ( $extensions['products'] as $key => $extension ) {
|
101 |
|
102 |
// get extension info
|
109 |
if ( $tab === 'premium' ) {
|
110 |
// exclude if not in this category
|
111 |
$category = isset($info['category'][0]['slug']) ? $info['category'][0]['slug'] : '';
|
112 |
+
//if ( $category != $tab && $info['slug'] != 'schema-premium' ) continue;
|
113 |
+
if ($category === 'official-free' ) continue;
|
114 |
} else {
|
115 |
// exclude if not in this category
|
116 |
$category = isset($info['category'][0]['slug']) ? $info['category'][0]['slug'] : '';
|
includes/json/knowledge-graph.php
CHANGED
@@ -77,20 +77,31 @@ function schema_wp_get_knowledge_graph_json() {
|
|
77 |
|
78 |
if ( empty($name) || empty($url) ) return;
|
79 |
|
80 |
-
// Set logo only when type = Organization
|
81 |
-
if ( $type == 'Organization' ) {
|
82 |
-
$logo = esc_attr( stripslashes( schema_wp_get_option( 'logo' ) ) );
|
83 |
-
} else {
|
84 |
-
$logo = '';
|
85 |
-
}
|
86 |
-
|
87 |
$schema['@context'] = "http://schema.org";
|
88 |
$schema['@type'] = $type;
|
89 |
-
$schema['@id'] = '#' . $organization_or_person;
|
90 |
|
91 |
if ( !empty($name) ) $schema['name'] = $name;
|
92 |
if ( !empty($url) ) $schema['url'] = $url;
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
// Get corporate contacts types array
|
96 |
$corporate_contacts_types = schema_wp_get_corporate_contacts_types_array();
|
77 |
|
78 |
if ( empty($name) || empty($url) ) return;
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
$schema['@context'] = "http://schema.org";
|
81 |
$schema['@type'] = $type;
|
82 |
+
$schema['@id'] = $url . '#' . $organization_or_person;
|
83 |
|
84 |
if ( !empty($name) ) $schema['name'] = $name;
|
85 |
if ( !empty($url) ) $schema['url'] = $url;
|
86 |
+
|
87 |
+
// Add logo
|
88 |
+
// @since 1.7.7
|
89 |
+
// Set logo only when type = Organization
|
90 |
+
if ( $type == 'Organization' ) {
|
91 |
+
$logo = esc_attr( stripslashes( schema_wp_get_option( 'logo' ) ) );
|
92 |
+
if ( !empty($logo) ) {
|
93 |
+
$logo_attachment_id = attachment_url_to_postid( $logo );
|
94 |
+
// If the above function fails, we can use the commented one below:
|
95 |
+
//$logo_attachment_id = schema_wp_get_attachment_id_from_url( $logo );
|
96 |
+
if ( !empty($logo_attachment_id) ) {
|
97 |
+
$schema['logo'] = schema_wp_get_image_object_by_attachment_id( $logo_attachment_id );
|
98 |
+
$schema['logo']['@id'] = $url . '#logo';
|
99 |
+
} else {
|
100 |
+
// It's external, use image url only
|
101 |
+
$schema['logo'] = $logo;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
|
106 |
// Get corporate contacts types array
|
107 |
$corporate_contacts_types = schema_wp_get_corporate_contacts_types_array();
|
includes/json/taxonomy.php
CHANGED
@@ -63,7 +63,7 @@ function schema_wp_get_taxonomy_json() {
|
|
63 |
|
64 |
$schema_json = get_post_meta( $post->ID, '_schema_json', true );
|
65 |
|
66 |
-
if ( isset($schema_json) ) {
|
67 |
$json[] = $schema_json;
|
68 |
}
|
69 |
|
63 |
|
64 |
$schema_json = get_post_meta( $post->ID, '_schema_json', true );
|
65 |
|
66 |
+
if ( isset($schema_json) && !empty($schema_json) ) {
|
67 |
$json[] = $schema_json;
|
68 |
}
|
69 |
|
includes/misc-functions.php
CHANGED
@@ -383,12 +383,70 @@ function schema_wp_get_media( $post_id = null) {
|
|
383 |
return apply_filters( 'schema_wp_filter_media', $media );
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
/**
|
387 |
* Get post single category,
|
388 |
* the first category
|
389 |
*
|
390 |
* @param int $post_id The post ID.
|
391 |
-
* @since 1.
|
392 |
*/
|
393 |
function schema_wp_get_post_category( $post_id ) {
|
394 |
|
@@ -429,7 +487,6 @@ function schema_wp_get_post_tags( $post_id ) {
|
|
429 |
return $tags;
|
430 |
}
|
431 |
|
432 |
-
|
433 |
/**
|
434 |
* Get an array of schema enabed categories
|
435 |
*
|
383 |
return apply_filters( 'schema_wp_filter_media', $media );
|
384 |
}
|
385 |
|
386 |
+
/**
|
387 |
+
* Retrieves the attachment ID from the file URL
|
388 |
+
*
|
389 |
+
* @param string $image_url The attachment image url
|
390 |
+
* @return string - attachment ID
|
391 |
+
* @since 1.7.7
|
392 |
+
*/
|
393 |
+
function schema_wp_get_attachment_id_from_url( $image_url ) {
|
394 |
+
|
395 |
+
global $wpdb;
|
396 |
+
|
397 |
+
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
|
398 |
+
|
399 |
+
return $attachment[0];
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Get ImageObject by attachment ID
|
404 |
+
*
|
405 |
+
* @param string $image_url The attachment image url
|
406 |
+
* @return array ImageObject
|
407 |
+
* @since 1.7.7
|
408 |
+
*/
|
409 |
+
function schema_wp_get_image_object_by_attachment_id( $attachment_id ) {
|
410 |
+
|
411 |
+
if ( ! isset($attachment_id) )
|
412 |
+
return array();
|
413 |
+
|
414 |
+
$ImageObject = array();
|
415 |
+
|
416 |
+
// Featured image
|
417 |
+
$image_attributes = wp_get_attachment_image_src( $attachment_id, 'full' );
|
418 |
+
|
419 |
+
if ( isset($image_attributes[0]) ) {
|
420 |
+
$url = $image_attributes[0];
|
421 |
+
$width = $image_attributes[1];
|
422 |
+
$height = $image_attributes[2];
|
423 |
+
|
424 |
+
$ImageObject = array (
|
425 |
+
'@type' => 'ImageObject',
|
426 |
+
'url' => $url,
|
427 |
+
'width' => $width,
|
428 |
+
'height' => $height,
|
429 |
+
);
|
430 |
+
|
431 |
+
// Add caption
|
432 |
+
$caption = wp_get_attachment_caption( $attachment_id );
|
433 |
+
If ($caption) {
|
434 |
+
$ImageObject['caption'] = $caption;
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
// debug
|
439 |
+
//echo'<pre>';print_r($image_attributes);echo'</pre>';exit;
|
440 |
+
|
441 |
+
return $ImageObject;
|
442 |
+
}
|
443 |
+
|
444 |
/**
|
445 |
* Get post single category,
|
446 |
* the first category
|
447 |
*
|
448 |
* @param int $post_id The post ID.
|
449 |
+
* @since 1.7.9
|
450 |
*/
|
451 |
function schema_wp_get_post_category( $post_id ) {
|
452 |
|
487 |
return $tags;
|
488 |
}
|
489 |
|
|
|
490 |
/**
|
491 |
* Get an array of schema enabed categories
|
492 |
*
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Schema ===
|
2 |
Contributors: hishaman, schemapress
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NGVUBT2QXN7YL
|
4 |
-
Tags: schema, schema.org,
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -90,6 +90,7 @@ Schema markup is code (semantic vocabulary) that you put on your website to help
|
|
90 |
* [Article](https://schema.press/docs-premium/add-schema-article/s)
|
91 |
* [Blog Posting](https://schema.press/docs-premium/add-schema-org-markup-blogposting/)
|
92 |
* [Event](https://schema.press/docs-premium/add-schema-org-event/)
|
|
|
93 |
* [Course](https://schema.press/docs-premium/add-schema-org-course/)
|
94 |
* [Job Posting](https://schema.org/JobPosting)
|
95 |
* [Local Business](https://schema.press/docs-premium/add-schema-localbusiness/)
|
@@ -111,7 +112,7 @@ Schema plugin integrates and/or play nicely with (not necessarily a full integra
|
|
111 |
* The SEO Framework
|
112 |
* Visual Composer
|
113 |
* ThirstyAffiliates
|
114 |
-
* **[Premium]** WooCommerce: [Schema for WooCommerce]() extension.
|
115 |
* Easy Digital Downloads (EDD)
|
116 |
|
117 |
### Supported Themes
|
@@ -198,6 +199,11 @@ Yes, Schema plugin will detect AMP plugin and output a more complete and valid s
|
|
198 |
|
199 |
== Changelog ==
|
200 |
|
|
|
|
|
|
|
|
|
|
|
201 |
= 1.7.5 =
|
202 |
* Fix: PHP Fatal error when truncating long headlines.
|
203 |
* Fix: PHP warning when parse HTML5-code, added a better error suppression.
|
1 |
=== Schema ===
|
2 |
Contributors: hishaman, schemapress
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NGVUBT2QXN7YL
|
4 |
+
Tags: schema, schema.org, rich snippets, structured data, json-ld, json, google, seo, markup, search engine, search, breadcrumbs, social, post, page, plugin, wordpress, content, article, news, search results, site name, knowledge graph, social, social profiles, keywords, meta-tags, metadata, tags, categories, optimize, ranking, search engine optimization, search engines, serp, sitelinks, google sitelinks, sitelinks search box, google sitelinks search box, semantic, structured, canonical, custom post types, post type, title, terms, media, images, thumb, featured, url, video, video markup, video object, VideoObject, video schema, audio object, AudioObject, audio schema, audio, sameAs, about, contact, amp, mobile, taxonomy
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.2.3
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 1.7.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
90 |
* [Article](https://schema.press/docs-premium/add-schema-article/s)
|
91 |
* [Blog Posting](https://schema.press/docs-premium/add-schema-org-markup-blogposting/)
|
92 |
* [Event](https://schema.press/docs-premium/add-schema-org-event/)
|
93 |
+
* [FAQPage](https://schema.press/docs-premium/add-schema-org-faq-page/)
|
94 |
* [Course](https://schema.press/docs-premium/add-schema-org-course/)
|
95 |
* [Job Posting](https://schema.org/JobPosting)
|
96 |
* [Local Business](https://schema.press/docs-premium/add-schema-localbusiness/)
|
112 |
* The SEO Framework
|
113 |
* Visual Composer
|
114 |
* ThirstyAffiliates
|
115 |
+
* **[Premium]** WooCommerce: [Schema for WooCommerce](https://schema.press/downloads/schema-woocommerce/) extension.
|
116 |
* Easy Digital Downloads (EDD)
|
117 |
|
118 |
### Supported Themes
|
199 |
|
200 |
== Changelog ==
|
201 |
|
202 |
+
= 1.7.6 =
|
203 |
+
* Fix: CSS for admin bar menu item.
|
204 |
+
* Tweak: Added premium extensions to extension page.
|
205 |
+
* Update: Pumped tested WordPress version to 5.2.3 release.
|
206 |
+
|
207 |
= 1.7.5 =
|
208 |
* Fix: PHP Fatal error when truncating long headlines.
|
209 |
* Fix: PHP warning when parse HTML5-code, added a better error suppression.
|
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.
|
9 |
* Text Domain: schema-wp
|
10 |
* Domain Path: languages
|
11 |
*
|
@@ -50,7 +50,7 @@ final class Schema_WP {
|
|
50 |
*
|
51 |
* @since 1.0
|
52 |
*/
|
53 |
-
private $version = '1.7.
|
54 |
|
55 |
/**
|
56 |
* 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.6
|
9 |
* Text Domain: schema-wp
|
10 |
* Domain Path: languages
|
11 |
*
|
50 |
*
|
51 |
* @since 1.0
|
52 |
*/
|
53 |
+
private $version = '1.7.6';
|
54 |
|
55 |
/**
|
56 |
* The settings instance variable
|