Version Description
(15 February 2019) =
- New Feature: TechArticle schema type add to the schema type list #115
- Added: Show admin notice, when schema's default image is not set inside setting #145
- Bug Fixed: Schema markup is not getting author name from the post #146
- Bug Fixed: When Review and Article schema are enabled at the same time. There is a validation error in logo markup #141
- Bug Fixed: Image is not being fetched in local_business schema markup from local schema image field #135
Download this release
Release Info
Developer | ampforwp |
Plugin | Schema & Structured Data for WP & AMP |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.1
- admin_section/add-schema/add_new.php +22 -12
- admin_section/plugin-installer/install.php +2 -1
- admin_section/structure_admin.php +9 -0
- output/output.php +176 -79
- output/review-output.php +3 -3
- output/service.php +77 -0
- readme.txt +10 -1
- structured-data-for-wp.php +23 -3
- view/post_specific.php +63 -4
- view/schema_type.php +5 -2
admin_section/add-schema/add_new.php
CHANGED
@@ -266,17 +266,24 @@ $saswp_add_data_type_config = array(
|
|
266 |
|
267 |
<?php
|
268 |
$last_post_id ='';
|
269 |
-
if(isset($_GET['step'])){
|
270 |
-
$step = $_GET['step'];
|
271 |
|
272 |
-
if($step
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
}
|
281 |
?>
|
282 |
|
@@ -354,7 +361,7 @@ $saswp_add_data_type_config = array(
|
|
354 |
function saswp_add_new_save_steps_data(){
|
355 |
|
356 |
if ( ! isset( $_POST['wpnonce'] ) ){
|
357 |
-
|
358 |
}
|
359 |
if ( !wp_verify_nonce( $_POST['wpnonce'], 'saswp_add_new_nonce' ) ){
|
360 |
return;
|
@@ -368,6 +375,7 @@ $saswp_add_data_type_config = array(
|
|
368 |
$schema_type = 'Local Business';
|
369 |
|
370 |
}
|
|
|
371 |
$user_id = get_current_user_id();
|
372 |
|
373 |
$schema_post = array(
|
@@ -439,9 +447,10 @@ $saswp_add_data_type_config = array(
|
|
439 |
<?php
|
440 |
}
|
441 |
function saswp_add_new_finish_page() {
|
|
|
442 |
global $saswp_add_data_type_config;
|
443 |
// Theme Name.
|
444 |
-
$plugin_title
|
445 |
// Strings passed in from the config file.
|
446 |
$strings = null;
|
447 |
|
@@ -635,6 +644,7 @@ $saswp_add_data_type_config = array(
|
|
635 |
}
|
636 |
|
637 |
function saswp_add_new_step_output_bottom_dots(){
|
|
|
638 |
global $saswp_add_data_type_config;
|
639 |
?>
|
640 |
<ol class="dots">
|
266 |
|
267 |
<?php
|
268 |
$last_post_id ='';
|
|
|
|
|
269 |
|
270 |
+
if(isset($_GET['step'])){
|
271 |
+
|
272 |
+
$step = $_GET['step'];
|
273 |
+
|
274 |
+
if($step == 2){
|
275 |
+
|
276 |
+
$last_post_id = json_decode(get_transient('saswp_last_post_id'), true);
|
277 |
+
$last_post_id = $last_post_id['post_id'];
|
278 |
+
|
279 |
+
}
|
280 |
+
$post = get_post($last_post_id);
|
281 |
+
|
282 |
+
if($post){
|
283 |
+
|
284 |
+
echo saswp_select_callback($post);
|
285 |
+
|
286 |
+
}
|
287 |
}
|
288 |
?>
|
289 |
|
361 |
function saswp_add_new_save_steps_data(){
|
362 |
|
363 |
if ( ! isset( $_POST['wpnonce'] ) ){
|
364 |
+
return;
|
365 |
}
|
366 |
if ( !wp_verify_nonce( $_POST['wpnonce'], 'saswp_add_new_nonce' ) ){
|
367 |
return;
|
375 |
$schema_type = 'Local Business';
|
376 |
|
377 |
}
|
378 |
+
|
379 |
$user_id = get_current_user_id();
|
380 |
|
381 |
$schema_post = array(
|
447 |
<?php
|
448 |
}
|
449 |
function saswp_add_new_finish_page() {
|
450 |
+
|
451 |
global $saswp_add_data_type_config;
|
452 |
// Theme Name.
|
453 |
+
$plugin_title = $saswp_add_data_type_config['plugin_title'];
|
454 |
// Strings passed in from the config file.
|
455 |
$strings = null;
|
456 |
|
644 |
}
|
645 |
|
646 |
function saswp_add_new_step_output_bottom_dots(){
|
647 |
+
|
648 |
global $saswp_add_data_type_config;
|
649 |
?>
|
650 |
<ol class="dots">
|
admin_section/plugin-installer/install.php
CHANGED
@@ -383,7 +383,8 @@
|
|
383 |
|
384 |
$sd_data = array_merge($pre_sd_data,$sd_data);
|
385 |
}
|
386 |
-
|
|
|
387 |
}
|
388 |
|
389 |
if(isset($_POST['sd_data_create__post_schema']) && isset($_POST['sd_data_create__post_schema_checkbox'])){
|
383 |
|
384 |
$sd_data = array_merge($pre_sd_data,$sd_data);
|
385 |
}
|
386 |
+
update_option('sd_data',$sd_data);
|
387 |
+
|
388 |
}
|
389 |
|
390 |
if(isset($_POST['sd_data_create__post_schema']) && isset($_POST['sd_data_create__post_schema_checkbox'])){
|
admin_section/structure_admin.php
CHANGED
@@ -800,8 +800,17 @@ function saswp_custom_breadcrumbs() {
|
|
800 |
$variables1_titles = array();
|
801 |
$variables2_links = array();
|
802 |
// Settings
|
|
|
803 |
$separator = '>';
|
804 |
$home_title = get_bloginfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
805 |
|
806 |
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
|
807 |
$custom_taxonomy = 'product_cat';
|
800 |
$variables1_titles = array();
|
801 |
$variables2_links = array();
|
802 |
// Settings
|
803 |
+
$home_title = '';
|
804 |
$separator = '>';
|
805 |
$home_title = get_bloginfo();
|
806 |
+
|
807 |
+
if(!$home_title){
|
808 |
+
if(isset($sd_data['sd_name'])){
|
809 |
+
$home_title = $sd_data['sd_name'];
|
810 |
+
}else{
|
811 |
+
$home_title = 'HomePage';
|
812 |
+
}
|
813 |
+
}
|
814 |
|
815 |
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
|
816 |
$custom_taxonomy = 'product_cat';
|
output/output.php
CHANGED
@@ -28,7 +28,7 @@ function saswp_kb_schema_output() {
|
|
28 |
if(isset($sd_data['sd_instagram']) && !empty($sd_data['sd_instagram'])){
|
29 |
$sd_instagram[] = $sd_data['sd_instagram'];
|
30 |
$sd_social_profile[] = $sd_instagram;
|
31 |
-
|
32 |
|
33 |
$sd_youtube = array();
|
34 |
if(isset($sd_data['sd_youtube']) && !empty($sd_data['sd_youtube'])){
|
@@ -52,13 +52,13 @@ function saswp_kb_schema_output() {
|
|
52 |
if(isset($sd_data['sd_soundcloud']) && !empty($sd_data['sd_soundcloud'])){
|
53 |
$sd_soundcloud[] = $sd_data['sd_soundcloud'];
|
54 |
$sd_social_profile[] = $sd_soundcloud;
|
55 |
-
|
56 |
|
57 |
$sd_tumblr = array();
|
58 |
if(isset($sd_data['sd_tumblr']) && !empty($sd_data['sd_tumblr'])){
|
59 |
$sd_tumblr[] = $sd_data['sd_tumblr'];
|
60 |
$sd_social_profile[] = $sd_tumblr;
|
61 |
-
|
62 |
|
63 |
$platform = array();
|
64 |
foreach ($sd_social_profile as $key => $value) {
|
@@ -97,11 +97,13 @@ function saswp_kb_schema_output() {
|
|
97 |
}
|
98 |
|
99 |
$contact_info = array(
|
|
|
100 |
'contactPoint' => array(
|
101 |
'@type' => 'ContactPoint',
|
102 |
'contactType' => $contact_1,
|
103 |
'telephone' => $telephone_1,
|
104 |
)
|
|
|
105 |
);
|
106 |
|
107 |
$input = array(
|
@@ -136,9 +138,11 @@ function saswp_kb_schema_output() {
|
|
136 |
$width = '';
|
137 |
|
138 |
if(isset($sd_data['sd-person-image'])){
|
|
|
139 |
$image = $sd_data['sd-person-image']['url'];
|
140 |
$height = $sd_data['sd-person-image']['height'];
|
141 |
$width = $sd_data['sd-person-image']['width'];
|
|
|
142 |
}
|
143 |
|
144 |
if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
|
@@ -154,15 +158,15 @@ function saswp_kb_schema_output() {
|
|
154 |
}
|
155 |
|
156 |
$input = array(
|
157 |
-
'@context' =>'http://schema.org',
|
158 |
'@type' => $sd_data['saswp_kb_type'],
|
159 |
'name' => $sd_data['sd-person-name'],
|
160 |
'url' => $sd_data['sd-person-url'],
|
161 |
'image' => array(
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
),
|
167 |
'telephone' => $sd_data['sd-person-phone-number'],
|
168 |
);
|
@@ -213,9 +217,13 @@ function saswp_schema_output() {
|
|
213 |
}
|
214 |
|
215 |
if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
|
216 |
-
|
|
|
|
|
217 |
}else{
|
218 |
-
|
|
|
|
|
219 |
}
|
220 |
//if(is_singular()){
|
221 |
// Generate author id
|
@@ -229,6 +237,14 @@ function saswp_schema_output() {
|
|
229 |
$modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
|
230 |
$aurthor_name = get_the_author();
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
$saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
|
233 |
|
234 |
$aggregateRating = array();
|
@@ -267,10 +283,10 @@ function saswp_schema_output() {
|
|
267 |
if(!empty($kkstar_rating_data)){
|
268 |
|
269 |
$kkstar_aggregateRating = array(
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
);
|
275 |
|
276 |
}
|
@@ -319,7 +335,7 @@ function saswp_schema_output() {
|
|
319 |
$input1 = array_merge($input1, $extra_theme_review);
|
320 |
}
|
321 |
if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
|
322 |
-
|
323 |
}
|
324 |
|
325 |
}
|
@@ -339,16 +355,16 @@ function saswp_schema_output() {
|
|
339 |
'datePublished' => $date,
|
340 |
'dateModified' => $modified_date,
|
341 |
'author' => array(
|
342 |
-
|
343 |
-
|
344 |
),
|
345 |
'Publisher' => array(
|
346 |
'@type' => 'Organization',
|
347 |
'logo' => array(
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
),
|
353 |
'name' => $site_name,
|
354 |
),
|
@@ -410,6 +426,23 @@ function saswp_schema_output() {
|
|
410 |
$input1 = array_merge($input1, $extra_theme_review);
|
411 |
}
|
412 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
if( 'Recipe' === $schema_type){
|
415 |
|
@@ -1295,7 +1328,7 @@ function saswp_post_specific_schema_output() {
|
|
1295 |
|
1296 |
$kkstar_aggregateRating = array(
|
1297 |
"@type"=> "AggregateRating",
|
1298 |
-
"bestRating"
|
1299 |
"ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
|
1300 |
"ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
|
1301 |
);
|
@@ -1350,7 +1383,7 @@ function saswp_post_specific_schema_output() {
|
|
1350 |
|
1351 |
if( 'Blogposting' === $schema_type){
|
1352 |
|
1353 |
-
$
|
1354 |
$input1 = array(
|
1355 |
'@context' => 'http://schema.org',
|
1356 |
'@type' => $schema_type ,
|
@@ -1371,8 +1404,8 @@ function saswp_post_specific_schema_output() {
|
|
1371 |
'logo' => array(
|
1372 |
'@type' => 'ImageObject',
|
1373 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_logo_'.$schema_id, 'saswp_array'),
|
1374 |
-
'width' => saswp_remove_warnings($
|
1375 |
-
'height' => saswp_remove_warnings($
|
1376 |
),
|
1377 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
|
1378 |
),
|
@@ -1419,7 +1452,7 @@ function saswp_post_specific_schema_output() {
|
|
1419 |
|
1420 |
if( 'WebPage' === $schema_type){
|
1421 |
|
1422 |
-
$
|
1423 |
$input1 = array(
|
1424 |
'@context' => 'http://schema.org',
|
1425 |
'@type' => $schema_type ,
|
@@ -1442,8 +1475,8 @@ function saswp_post_specific_schema_output() {
|
|
1442 |
'logo' => array(
|
1443 |
'@type' => 'ImageObject',
|
1444 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_logo_'.$schema_id, 'saswp_array'),
|
1445 |
-
'width' => saswp_remove_warnings($
|
1446 |
-
'height' => saswp_remove_warnings($
|
1447 |
),
|
1448 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_name_'.$schema_id, 'saswp_array'),
|
1449 |
),
|
@@ -1470,7 +1503,7 @@ function saswp_post_specific_schema_output() {
|
|
1470 |
|
1471 |
if( 'Article' === $schema_type ){
|
1472 |
|
1473 |
-
$
|
1474 |
|
1475 |
$input1 = array(
|
1476 |
'@context' => 'http://schema.org',
|
@@ -1490,8 +1523,8 @@ function saswp_post_specific_schema_output() {
|
|
1490 |
'logo' => array(
|
1491 |
'@type' => 'ImageObject',
|
1492 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_logo_'.$schema_id, 'saswp_array'),
|
1493 |
-
'width' => saswp_remove_warnings($
|
1494 |
-
'height' => saswp_remove_warnings($
|
1495 |
),
|
1496 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
|
1497 |
),
|
@@ -1508,6 +1541,47 @@ function saswp_post_specific_schema_output() {
|
|
1508 |
|
1509 |
}
|
1510 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1511 |
|
1512 |
if( 'Recipe' === $schema_type){
|
1513 |
|
@@ -1674,7 +1748,7 @@ function saswp_post_specific_schema_output() {
|
|
1674 |
|
1675 |
if( 'NewsArticle' === $schema_type ){
|
1676 |
|
1677 |
-
$
|
1678 |
$author_image = get_post_meta( get_the_ID(), 'saswp_newsarticle_author_image_'.$schema_id.'_detail',true);
|
1679 |
|
1680 |
$input1 = array(
|
@@ -1711,8 +1785,8 @@ function saswp_post_specific_schema_output() {
|
|
1711 |
'logo' => array(
|
1712 |
'@type' => 'ImageObject',
|
1713 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_logo_'.$schema_id, 'saswp_array'),
|
1714 |
-
'width' => saswp_remove_warnings($
|
1715 |
-
'height' => saswp_remove_warnings($
|
1716 |
),
|
1717 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_name_'.$schema_id, 'saswp_array'),
|
1718 |
),
|
@@ -1727,7 +1801,7 @@ function saswp_post_specific_schema_output() {
|
|
1727 |
|
1728 |
if( 'VideoObject' === $schema_type){
|
1729 |
|
1730 |
-
$
|
1731 |
$author_image = get_post_meta( get_the_ID(), 'saswp_video_object_author_image_'.$schema_id.'_detail',true);
|
1732 |
|
1733 |
$input1 = array(
|
@@ -1760,8 +1834,8 @@ function saswp_post_specific_schema_output() {
|
|
1760 |
'logo' => array(
|
1761 |
'@type' => 'ImageObject',
|
1762 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_organization_logo_'.$schema_id, 'saswp_array'),
|
1763 |
-
'width' => saswp_remove_warnings($
|
1764 |
-
'height' => saswp_remove_warnings($
|
1765 |
),
|
1766 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_organization_name_'.$schema_id, 'saswp_array'),
|
1767 |
),
|
@@ -1778,7 +1852,8 @@ function saswp_post_specific_schema_output() {
|
|
1778 |
|
1779 |
}
|
1780 |
|
1781 |
-
if( 'Service' === $schema_type ){
|
|
|
1782 |
$area_served_str = saswp_remove_warnings($all_post_meta, 'saswp_service_schema_area_served_'.$schema_id, 'saswp_array');
|
1783 |
$area_served_arr = explode(',', $area_served_str);
|
1784 |
|
@@ -2050,13 +2125,7 @@ function saswp_post_specific_schema_output() {
|
|
2050 |
default:
|
2051 |
$input1 = $input1;
|
2052 |
break;
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
|
2061 |
if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
|
2062 |
|
@@ -2066,6 +2135,7 @@ function saswp_post_specific_schema_output() {
|
|
2066 |
"bestRating" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_review_count_'.$schema_id, 'saswp_array')
|
2067 |
);
|
2068 |
}
|
|
|
2069 |
|
2070 |
}
|
2071 |
|
@@ -2170,8 +2240,8 @@ function saswp_post_specific_schema_output() {
|
|
2170 |
if(!empty($input1)){
|
2171 |
$all_schema_output[] = $input1;
|
2172 |
}
|
2173 |
-
|
2174 |
-
|
2175 |
}
|
2176 |
|
2177 |
return $all_schema_output;
|
@@ -2197,6 +2267,7 @@ function saswp_list_items_generator(){
|
|
2197 |
global $sd_data;
|
2198 |
$bc_titles = array();
|
2199 |
$bc_links = array();
|
|
|
2200 |
if(isset($sd_data['titles'])){
|
2201 |
$bc_titles = $sd_data['titles'];
|
2202 |
}
|
@@ -2210,8 +2281,10 @@ function saswp_list_items_generator(){
|
|
2210 |
|
2211 |
if(is_single()){
|
2212 |
|
2213 |
-
if(isset($bc_titles)){
|
|
|
2214 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
|
|
2215 |
$breadcrumbslist[] = array(
|
2216 |
'@type' => 'ListItem',
|
2217 |
'position' => $j,
|
@@ -2220,13 +2293,17 @@ function saswp_list_items_generator(){
|
|
2220 |
'name' => $bc_titles[$i],
|
2221 |
),
|
2222 |
);
|
2223 |
-
|
2224 |
-
|
|
|
|
|
|
|
2225 |
|
2226 |
}
|
2227 |
if(is_page()){
|
2228 |
|
2229 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
|
|
2230 |
$breadcrumbslist[] = array(
|
2231 |
'@type' => 'ListItem',
|
2232 |
'position' => $j,
|
@@ -2235,13 +2312,16 @@ function saswp_list_items_generator(){
|
|
2235 |
'name' => $bc_titles[$i],
|
2236 |
),
|
2237 |
);
|
|
|
2238 |
$j++;
|
2239 |
-
|
|
|
2240 |
|
2241 |
}
|
2242 |
if(is_archive()){
|
2243 |
|
2244 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
|
|
2245 |
$breadcrumbslist[] = array(
|
2246 |
'@type' => 'ListItem',
|
2247 |
'position' => $j,
|
@@ -2251,6 +2331,7 @@ function saswp_list_items_generator(){
|
|
2251 |
),
|
2252 |
);
|
2253 |
$j++;
|
|
|
2254 |
}
|
2255 |
}
|
2256 |
|
@@ -2264,17 +2345,22 @@ function saswp_schema_breadcrumb_output($sd_data){
|
|
2264 |
if(isset($sd_data['saswp_breadcrumb_schema']) && $sd_data['saswp_breadcrumb_schema'] == 1){
|
2265 |
|
2266 |
if(is_single() || is_page() ||is_archive()){
|
2267 |
-
|
2268 |
-
|
|
|
|
|
|
|
2269 |
$input = array(
|
2270 |
'@context' => 'http://schema.org',
|
2271 |
'@type' => 'BreadcrumbList' ,
|
2272 |
-
'itemListElement'
|
2273 |
-
);
|
2274 |
-
|
2275 |
-
|
|
|
|
|
2276 |
|
2277 |
-
|
2278 |
|
2279 |
}
|
2280 |
}
|
@@ -2289,15 +2375,15 @@ function saswp_kb_website_output(){
|
|
2289 |
if($site_url && $site_name){
|
2290 |
|
2291 |
$input = array(
|
2292 |
-
'@context'
|
2293 |
-
'@type'
|
2294 |
-
'id'
|
2295 |
-
'url'
|
2296 |
-
'name'
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
)
|
2302 |
);
|
2303 |
}
|
@@ -2364,7 +2450,7 @@ function saswp_archive_output(){
|
|
2364 |
"width" => $logo['width'],
|
2365 |
"height" => $logo['height'],
|
2366 |
"url" => $logo['url']
|
2367 |
-
|
2368 |
);
|
2369 |
$publisher_info['name'] = get_bloginfo('name');
|
2370 |
$publisher_info['id'] = get_the_permalink();
|
@@ -2634,6 +2720,7 @@ function saswp_contact_page_output()
|
|
2634 |
function saswp_get_comments($post_id){
|
2635 |
|
2636 |
$comment_count = get_comments_number( $post_id );
|
|
|
2637 |
if ( $comment_count < 1 ) {
|
2638 |
return array();
|
2639 |
}
|
@@ -2650,7 +2737,9 @@ function saswp_get_comments($post_id){
|
|
2650 |
);
|
2651 |
|
2652 |
if ( count( $post_comments ) ) {
|
|
|
2653 |
foreach ( $post_comments as $comment ) {
|
|
|
2654 |
$comments[] = array (
|
2655 |
'@type' => 'Comment',
|
2656 |
'dateCreated' => $comment->comment_date,
|
@@ -2662,6 +2751,7 @@ function saswp_get_comments($post_id){
|
|
2662 |
),
|
2663 |
);
|
2664 |
}
|
|
|
2665 |
return apply_filters( 'saswp_filter_comments', $comments );
|
2666 |
}
|
2667 |
|
@@ -2680,25 +2770,32 @@ function saswp_get_schema_data($schema_id, $schema_key){
|
|
2680 |
return $details;
|
2681 |
}
|
2682 |
|
2683 |
-
function saswp_extract_kk_star_ratings($id)
|
2684 |
-
|
2685 |
global $sd_data;
|
2686 |
|
2687 |
-
if(isset($sd_data['saswp-kk-star-raring']) && $sd_data['saswp-kk-star-raring'] ==1){
|
2688 |
|
2689 |
-
$best
|
2690 |
$score = get_post_meta($id, '_kksr_ratings', true) ? ((int) get_post_meta($id, '_kksr_ratings', true)) : 0;
|
2691 |
$votes = get_post_meta($id, '_kksr_casts', true) ? ((int) get_post_meta($id, '_kksr_casts', true)) : 0;
|
2692 |
-
$avg
|
2693 |
-
$per
|
|
|
2694 |
if($votes>0){
|
2695 |
-
|
|
|
|
|
2696 |
}else{
|
2697 |
-
|
|
|
|
|
2698 |
}
|
2699 |
|
2700 |
}else{
|
|
|
2701 |
return array();
|
|
|
2702 |
}
|
2703 |
}
|
2704 |
|
@@ -2722,7 +2819,7 @@ function saswp_reading_time_and_word_count() {
|
|
2722 |
|
2723 |
function saswp_remove_warnings($data, $index, $type){
|
2724 |
|
2725 |
-
if($type =='saswp_array'){
|
2726 |
|
2727 |
if(isset($data[$index])){
|
2728 |
return $data[$index][0];
|
@@ -2731,12 +2828,12 @@ function saswp_remove_warnings($data, $index, $type){
|
|
2731 |
}
|
2732 |
}
|
2733 |
|
2734 |
-
if($type =='saswp_string'){
|
2735 |
|
2736 |
if(isset($data[$index])){
|
2737 |
return $data[$index];
|
2738 |
}else{
|
2739 |
return '';
|
2740 |
}
|
2741 |
-
|
2742 |
}
|
28 |
if(isset($sd_data['sd_instagram']) && !empty($sd_data['sd_instagram'])){
|
29 |
$sd_instagram[] = $sd_data['sd_instagram'];
|
30 |
$sd_social_profile[] = $sd_instagram;
|
31 |
+
}
|
32 |
|
33 |
$sd_youtube = array();
|
34 |
if(isset($sd_data['sd_youtube']) && !empty($sd_data['sd_youtube'])){
|
52 |
if(isset($sd_data['sd_soundcloud']) && !empty($sd_data['sd_soundcloud'])){
|
53 |
$sd_soundcloud[] = $sd_data['sd_soundcloud'];
|
54 |
$sd_social_profile[] = $sd_soundcloud;
|
55 |
+
}
|
56 |
|
57 |
$sd_tumblr = array();
|
58 |
if(isset($sd_data['sd_tumblr']) && !empty($sd_data['sd_tumblr'])){
|
59 |
$sd_tumblr[] = $sd_data['sd_tumblr'];
|
60 |
$sd_social_profile[] = $sd_tumblr;
|
61 |
+
}
|
62 |
|
63 |
$platform = array();
|
64 |
foreach ($sd_social_profile as $key => $value) {
|
97 |
}
|
98 |
|
99 |
$contact_info = array(
|
100 |
+
|
101 |
'contactPoint' => array(
|
102 |
'@type' => 'ContactPoint',
|
103 |
'contactType' => $contact_1,
|
104 |
'telephone' => $telephone_1,
|
105 |
)
|
106 |
+
|
107 |
);
|
108 |
|
109 |
$input = array(
|
138 |
$width = '';
|
139 |
|
140 |
if(isset($sd_data['sd-person-image'])){
|
141 |
+
|
142 |
$image = $sd_data['sd-person-image']['url'];
|
143 |
$height = $sd_data['sd-person-image']['height'];
|
144 |
$width = $sd_data['sd-person-image']['width'];
|
145 |
+
|
146 |
}
|
147 |
|
148 |
if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
|
158 |
}
|
159 |
|
160 |
$input = array(
|
161 |
+
'@context' => 'http://schema.org',
|
162 |
'@type' => $sd_data['saswp_kb_type'],
|
163 |
'name' => $sd_data['sd-person-name'],
|
164 |
'url' => $sd_data['sd-person-url'],
|
165 |
'image' => array(
|
166 |
+
'@type' => 'ImageObject',
|
167 |
+
'url' => $image,
|
168 |
+
'width' => $width,
|
169 |
+
'height' => $height,
|
170 |
),
|
171 |
'telephone' => $sd_data['sd-person-phone-number'],
|
172 |
);
|
217 |
}
|
218 |
|
219 |
if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
|
220 |
+
|
221 |
+
$site_name = $sd_data['sd_name'];
|
222 |
+
|
223 |
}else{
|
224 |
+
|
225 |
+
$site_name = get_bloginfo();
|
226 |
+
|
227 |
}
|
228 |
//if(is_singular()){
|
229 |
// Generate author id
|
237 |
$modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
|
238 |
$aurthor_name = get_the_author();
|
239 |
|
240 |
+
if(!$aurthor_name){
|
241 |
+
|
242 |
+
$author_id = get_post_field ('post_author', $schema_post_id);
|
243 |
+
$aurthor_name = get_the_author_meta( 'display_name' , $author_id );
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
$saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
|
249 |
|
250 |
$aggregateRating = array();
|
283 |
if(!empty($kkstar_rating_data)){
|
284 |
|
285 |
$kkstar_aggregateRating = array(
|
286 |
+
"@type" => "AggregateRating",
|
287 |
+
"bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
|
288 |
+
"ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
|
289 |
+
"ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
|
290 |
);
|
291 |
|
292 |
}
|
335 |
$input1 = array_merge($input1, $extra_theme_review);
|
336 |
}
|
337 |
if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
|
338 |
+
$input1['comment'] = saswp_get_comments(get_the_ID());
|
339 |
}
|
340 |
|
341 |
}
|
355 |
'datePublished' => $date,
|
356 |
'dateModified' => $modified_date,
|
357 |
'author' => array(
|
358 |
+
'@type' => 'Person',
|
359 |
+
'name' => $aurthor_name
|
360 |
),
|
361 |
'Publisher' => array(
|
362 |
'@type' => 'Organization',
|
363 |
'logo' => array(
|
364 |
+
'@type' => 'ImageObject',
|
365 |
+
'url' => $logo,
|
366 |
+
'width' => $width,
|
367 |
+
'height' => $height,
|
368 |
),
|
369 |
'name' => $site_name,
|
370 |
),
|
426 |
$input1 = array_merge($input1, $extra_theme_review);
|
427 |
}
|
428 |
}
|
429 |
+
|
430 |
+
if( 'TechArticle' === $schema_type ){
|
431 |
+
|
432 |
+
$service = new saswp_output_service();
|
433 |
+
$input1 = $service->saswp_schema_markup_generator($schema_type);
|
434 |
+
|
435 |
+
if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
|
436 |
+
$service = new saswp_output_service();
|
437 |
+
$input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
|
438 |
+
}
|
439 |
+
if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
|
440 |
+
$input1['comment'] = saswp_get_comments(get_the_ID());
|
441 |
+
}
|
442 |
+
if(!empty($extra_theme_review)){
|
443 |
+
$input1 = array_merge($input1, $extra_theme_review);
|
444 |
+
}
|
445 |
+
}
|
446 |
|
447 |
if( 'Recipe' === $schema_type){
|
448 |
|
1328 |
|
1329 |
$kkstar_aggregateRating = array(
|
1330 |
"@type"=> "AggregateRating",
|
1331 |
+
"bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
|
1332 |
"ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
|
1333 |
"ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
|
1334 |
);
|
1383 |
|
1384 |
if( 'Blogposting' === $schema_type){
|
1385 |
|
1386 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_blogposting_organization_logo_'.$schema_id.'_detail',true);
|
1387 |
$input1 = array(
|
1388 |
'@context' => 'http://schema.org',
|
1389 |
'@type' => $schema_type ,
|
1404 |
'logo' => array(
|
1405 |
'@type' => 'ImageObject',
|
1406 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_logo_'.$schema_id, 'saswp_array'),
|
1407 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1408 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1409 |
),
|
1410 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
|
1411 |
),
|
1452 |
|
1453 |
if( 'WebPage' === $schema_type){
|
1454 |
|
1455 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_webpage_organization_logo_'.$schema_id.'_detail',true);
|
1456 |
$input1 = array(
|
1457 |
'@context' => 'http://schema.org',
|
1458 |
'@type' => $schema_type ,
|
1475 |
'logo' => array(
|
1476 |
'@type' => 'ImageObject',
|
1477 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_logo_'.$schema_id, 'saswp_array'),
|
1478 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1479 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1480 |
),
|
1481 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_organization_name_'.$schema_id, 'saswp_array'),
|
1482 |
),
|
1503 |
|
1504 |
if( 'Article' === $schema_type ){
|
1505 |
|
1506 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_article_organization_logo_'.$schema_id.'_detail',true);
|
1507 |
|
1508 |
$input1 = array(
|
1509 |
'@context' => 'http://schema.org',
|
1523 |
'logo' => array(
|
1524 |
'@type' => 'ImageObject',
|
1525 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_logo_'.$schema_id, 'saswp_array'),
|
1526 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1527 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1528 |
),
|
1529 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
|
1530 |
),
|
1541 |
|
1542 |
}
|
1543 |
}
|
1544 |
+
|
1545 |
+
if( 'TechArticle' === $schema_type ){
|
1546 |
+
|
1547 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_tech_article_organization_logo_'.$schema_id.'_detail',true);
|
1548 |
+
|
1549 |
+
$input1 = array(
|
1550 |
+
'@context' => 'http://schema.org',
|
1551 |
+
'@type' => 'TechArticle',
|
1552 |
+
'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_main_entity_of_page_'.$schema_id, 'saswp_array'),
|
1553 |
+
'image' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_image_'.$schema_id, 'saswp_array'),
|
1554 |
+
'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
|
1555 |
+
'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
|
1556 |
+
'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_published_'.$schema_id, 'saswp_array'),
|
1557 |
+
'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_modified_'.$schema_id, 'saswp_array'),
|
1558 |
+
'author' => array(
|
1559 |
+
'@type' => 'Person',
|
1560 |
+
'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
|
1561 |
+
),
|
1562 |
+
'Publisher' => array(
|
1563 |
+
'@type' => 'Organization',
|
1564 |
+
'logo' => array(
|
1565 |
+
'@type' => 'ImageObject',
|
1566 |
+
'url' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_organization_logo_'.$schema_id, 'saswp_array'),
|
1567 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1568 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1569 |
+
),
|
1570 |
+
'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_organization_name_'.$schema_id, 'saswp_array'),
|
1571 |
+
),
|
1572 |
+
|
1573 |
+
);
|
1574 |
+
if(!empty($kkstar_aggregateRating)){
|
1575 |
+
|
1576 |
+
$input1['aggregateRating'] = $kkstar_aggregateRating;
|
1577 |
+
|
1578 |
+
}
|
1579 |
+
if(!empty($extra_theme_review)){
|
1580 |
+
|
1581 |
+
$input1 = array_merge($input1, $extra_theme_review);
|
1582 |
+
|
1583 |
+
}
|
1584 |
+
}
|
1585 |
|
1586 |
if( 'Recipe' === $schema_type){
|
1587 |
|
1748 |
|
1749 |
if( 'NewsArticle' === $schema_type ){
|
1750 |
|
1751 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_newsarticle_organization_logo_'.$schema_id.'_detail',true);
|
1752 |
$author_image = get_post_meta( get_the_ID(), 'saswp_newsarticle_author_image_'.$schema_id.'_detail',true);
|
1753 |
|
1754 |
$input1 = array(
|
1785 |
'logo' => array(
|
1786 |
'@type' => 'ImageObject',
|
1787 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_logo_'.$schema_id, 'saswp_array'),
|
1788 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1789 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1790 |
),
|
1791 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_name_'.$schema_id, 'saswp_array'),
|
1792 |
),
|
1801 |
|
1802 |
if( 'VideoObject' === $schema_type){
|
1803 |
|
1804 |
+
$slogo = get_post_meta( get_the_ID(), 'saswp_video_object_organization_logo_'.$schema_id.'_detail',true);
|
1805 |
$author_image = get_post_meta( get_the_ID(), 'saswp_video_object_author_image_'.$schema_id.'_detail',true);
|
1806 |
|
1807 |
$input1 = array(
|
1834 |
'logo' => array(
|
1835 |
'@type' => 'ImageObject',
|
1836 |
'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_organization_logo_'.$schema_id, 'saswp_array'),
|
1837 |
+
'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
|
1838 |
+
'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
|
1839 |
),
|
1840 |
'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_organization_name_'.$schema_id, 'saswp_array'),
|
1841 |
),
|
1852 |
|
1853 |
}
|
1854 |
|
1855 |
+
if( 'Service' === $schema_type ){
|
1856 |
+
|
1857 |
$area_served_str = saswp_remove_warnings($all_post_meta, 'saswp_service_schema_area_served_'.$schema_id, 'saswp_array');
|
1858 |
$area_served_arr = explode(',', $area_served_str);
|
1859 |
|
2125 |
default:
|
2126 |
$input1 = $input1;
|
2127 |
break;
|
2128 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2129 |
|
2130 |
if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
|
2131 |
|
2135 |
"bestRating" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_review_count_'.$schema_id, 'saswp_array')
|
2136 |
);
|
2137 |
}
|
2138 |
+
unset($input1['aggregateRating']);
|
2139 |
|
2140 |
}
|
2141 |
|
2240 |
if(!empty($input1)){
|
2241 |
$all_schema_output[] = $input1;
|
2242 |
}
|
2243 |
+
}
|
2244 |
+
}
|
2245 |
}
|
2246 |
|
2247 |
return $all_schema_output;
|
2267 |
global $sd_data;
|
2268 |
$bc_titles = array();
|
2269 |
$bc_links = array();
|
2270 |
+
|
2271 |
if(isset($sd_data['titles'])){
|
2272 |
$bc_titles = $sd_data['titles'];
|
2273 |
}
|
2281 |
|
2282 |
if(is_single()){
|
2283 |
|
2284 |
+
if(isset($bc_titles)){
|
2285 |
+
|
2286 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
2287 |
+
|
2288 |
$breadcrumbslist[] = array(
|
2289 |
'@type' => 'ListItem',
|
2290 |
'position' => $j,
|
2293 |
'name' => $bc_titles[$i],
|
2294 |
),
|
2295 |
);
|
2296 |
+
|
2297 |
+
$j++;
|
2298 |
+
}
|
2299 |
+
|
2300 |
+
}
|
2301 |
|
2302 |
}
|
2303 |
if(is_page()){
|
2304 |
|
2305 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
2306 |
+
|
2307 |
$breadcrumbslist[] = array(
|
2308 |
'@type' => 'ListItem',
|
2309 |
'position' => $j,
|
2312 |
'name' => $bc_titles[$i],
|
2313 |
),
|
2314 |
);
|
2315 |
+
|
2316 |
$j++;
|
2317 |
+
|
2318 |
+
}
|
2319 |
|
2320 |
}
|
2321 |
if(is_archive()){
|
2322 |
|
2323 |
for($i=0;$i<sizeof($bc_titles);$i++){
|
2324 |
+
|
2325 |
$breadcrumbslist[] = array(
|
2326 |
'@type' => 'ListItem',
|
2327 |
'position' => $j,
|
2331 |
),
|
2332 |
);
|
2333 |
$j++;
|
2334 |
+
|
2335 |
}
|
2336 |
}
|
2337 |
|
2345 |
if(isset($sd_data['saswp_breadcrumb_schema']) && $sd_data['saswp_breadcrumb_schema'] == 1){
|
2346 |
|
2347 |
if(is_single() || is_page() ||is_archive()){
|
2348 |
+
|
2349 |
+
$bread_crumb_list = saswp_list_items_generator();
|
2350 |
+
|
2351 |
+
if(!empty($bread_crumb_list)){
|
2352 |
+
|
2353 |
$input = array(
|
2354 |
'@context' => 'http://schema.org',
|
2355 |
'@type' => 'BreadcrumbList' ,
|
2356 |
+
'itemListElement' => $bread_crumb_list,
|
2357 |
+
);
|
2358 |
+
|
2359 |
+
return json_encode($input);
|
2360 |
+
|
2361 |
+
}
|
2362 |
|
2363 |
+
}
|
2364 |
|
2365 |
}
|
2366 |
}
|
2375 |
if($site_url && $site_name){
|
2376 |
|
2377 |
$input = array(
|
2378 |
+
'@context' => 'http://schema.org',
|
2379 |
+
'@type' => 'WebSite',
|
2380 |
+
'id' => '#website',
|
2381 |
+
'url' => $site_url,
|
2382 |
+
'name' => $site_name,
|
2383 |
+
'potentialAction' => array(
|
2384 |
+
'@type' => 'SearchAction',
|
2385 |
+
'target' => $site_url.'/?s={search_term_string}',
|
2386 |
+
'query-input' => 'required name=search_term_string',
|
2387 |
)
|
2388 |
);
|
2389 |
}
|
2450 |
"width" => $logo['width'],
|
2451 |
"height" => $logo['height'],
|
2452 |
"url" => $logo['url']
|
2453 |
+
)
|
2454 |
);
|
2455 |
$publisher_info['name'] = get_bloginfo('name');
|
2456 |
$publisher_info['id'] = get_the_permalink();
|
2720 |
function saswp_get_comments($post_id){
|
2721 |
|
2722 |
$comment_count = get_comments_number( $post_id );
|
2723 |
+
|
2724 |
if ( $comment_count < 1 ) {
|
2725 |
return array();
|
2726 |
}
|
2737 |
);
|
2738 |
|
2739 |
if ( count( $post_comments ) ) {
|
2740 |
+
|
2741 |
foreach ( $post_comments as $comment ) {
|
2742 |
+
|
2743 |
$comments[] = array (
|
2744 |
'@type' => 'Comment',
|
2745 |
'dateCreated' => $comment->comment_date,
|
2751 |
),
|
2752 |
);
|
2753 |
}
|
2754 |
+
|
2755 |
return apply_filters( 'saswp_filter_comments', $comments );
|
2756 |
}
|
2757 |
|
2770 |
return $details;
|
2771 |
}
|
2772 |
|
2773 |
+
function saswp_extract_kk_star_ratings($id){
|
2774 |
+
|
2775 |
global $sd_data;
|
2776 |
|
2777 |
+
if(isset($sd_data['saswp-kk-star-raring']) && $sd_data['saswp-kk-star-raring'] == 1){
|
2778 |
|
2779 |
+
$best = get_option('kksr_stars');
|
2780 |
$score = get_post_meta($id, '_kksr_ratings', true) ? ((int) get_post_meta($id, '_kksr_ratings', true)) : 0;
|
2781 |
$votes = get_post_meta($id, '_kksr_casts', true) ? ((int) get_post_meta($id, '_kksr_casts', true)) : 0;
|
2782 |
+
$avg = $score && $votes ? round((float)(($score/$votes)*($best/5)), 1) : 0;
|
2783 |
+
$per = $score && $votes ? round((float)((($score/$votes)/5)*100), 2) : 0;
|
2784 |
+
|
2785 |
if($votes>0){
|
2786 |
+
|
2787 |
+
return compact('best', 'score', 'votes', 'avg', 'per');
|
2788 |
+
|
2789 |
}else{
|
2790 |
+
|
2791 |
+
return array();
|
2792 |
+
|
2793 |
}
|
2794 |
|
2795 |
}else{
|
2796 |
+
|
2797 |
return array();
|
2798 |
+
|
2799 |
}
|
2800 |
}
|
2801 |
|
2819 |
|
2820 |
function saswp_remove_warnings($data, $index, $type){
|
2821 |
|
2822 |
+
if($type == 'saswp_array'){
|
2823 |
|
2824 |
if(isset($data[$index])){
|
2825 |
return $data[$index][0];
|
2828 |
}
|
2829 |
}
|
2830 |
|
2831 |
+
if($type == 'saswp_string'){
|
2832 |
|
2833 |
if(isset($data[$index])){
|
2834 |
return $data[$index];
|
2835 |
}else{
|
2836 |
return '';
|
2837 |
}
|
2838 |
+
}
|
2839 |
}
|
output/review-output.php
CHANGED
@@ -55,7 +55,7 @@ Class saswp_review_output{
|
|
55 |
|
56 |
$boxdata ='';
|
57 |
|
58 |
-
if($saswp_review_props !='' || $saswp_review_cons != '' ){
|
59 |
|
60 |
$boxdata .='
|
61 |
<div class="saswp-pc-wrap">
|
@@ -71,9 +71,9 @@ Class saswp_review_output{
|
|
71 |
|
72 |
}
|
73 |
|
74 |
-
if(!empty($saswp_review_item_feature) || $saswp_review_description !=''){
|
75 |
|
76 |
-
|
77 |
<tbody>
|
78 |
<div class="saswp-rvw-hd">
|
79 |
<span>'.esc_html__('REVIEW OVERVIEW', 'schema-and-structured-data-for-wp').'</span>
|
55 |
|
56 |
$boxdata ='';
|
57 |
|
58 |
+
if($saswp_review_props != '' || $saswp_review_cons != '' ){
|
59 |
|
60 |
$boxdata .='
|
61 |
<div class="saswp-pc-wrap">
|
71 |
|
72 |
}
|
73 |
|
74 |
+
if(!empty($saswp_review_item_feature) || $saswp_review_description != ''){
|
75 |
|
76 |
+
$boxdata.='<table class="saswp-rvw">
|
77 |
<tbody>
|
78 |
<div class="saswp-rvw-hd">
|
79 |
<span>'.esc_html__('REVIEW OVERVIEW', 'schema-and-structured-data-for-wp').'</span>
|
output/service.php
CHANGED
@@ -267,6 +267,39 @@ Class saswp_output_service{
|
|
267 |
$input1['Publisher']['logo']['url'] = $custom_fields['saswp_article_organization_logo'];
|
268 |
}
|
269 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
case 'Recipe':
|
272 |
if(isset($custom_fields['saswp_recipe_url'])){
|
@@ -1044,6 +1077,21 @@ Class saswp_output_service{
|
|
1044 |
);
|
1045 |
break;
|
1046 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1047 |
case 'Recipe':
|
1048 |
|
1049 |
$meta_field = array(
|
@@ -1247,6 +1295,35 @@ Class saswp_output_service{
|
|
1247 |
|
1248 |
switch ($schema_type) {
|
1249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1250 |
case 'Article':
|
1251 |
|
1252 |
$input1 = array(
|
267 |
$input1['Publisher']['logo']['url'] = $custom_fields['saswp_article_organization_logo'];
|
268 |
}
|
269 |
break;
|
270 |
+
|
271 |
+
case 'TechArticle':
|
272 |
+
|
273 |
+
if(isset($custom_fields['saswp_tech_article_main_entity_of_page'])){
|
274 |
+
$input1['mainEntityOfPage'] = $custom_fields['saswp_tech_article_main_entity_of_page'];
|
275 |
+
}
|
276 |
+
if(isset($custom_fields['saswp_tech_article_image'])){
|
277 |
+
$input1['image'] = $custom_fields['saswp_tech_article_image'];
|
278 |
+
}
|
279 |
+
if(isset($custom_fields['saswp_tech_article_headline'])){
|
280 |
+
$input1['headline'] = $custom_fields['saswp_tech_article_headline'];
|
281 |
+
}
|
282 |
+
|
283 |
+
if(isset($custom_fields['saswp_tech_article_description'])){
|
284 |
+
$input1['description'] = $custom_fields['saswp_tech_article_description'];
|
285 |
+
}
|
286 |
+
if(isset($custom_fields['saswp_tech_article_date_published'])){
|
287 |
+
$input1['datePublished'] = $custom_fields['saswp_tech_article_date_published'];
|
288 |
+
}
|
289 |
+
if(isset($custom_fields['saswp_tech_article_date_modified'])){
|
290 |
+
$input1['dateModified'] = $custom_fields['saswp_tech_article_date_modified'];
|
291 |
+
}
|
292 |
+
|
293 |
+
if(isset($custom_fields['saswp_tech_article_author_name'])){
|
294 |
+
$input1['author']['name'] = $custom_fields['saswp_tech_article_author_name'];
|
295 |
+
}
|
296 |
+
if(isset($custom_fields['saswp_tech_article_organization_name'])){
|
297 |
+
$input1['Publisher']['name'] = $custom_fields['saswp_tech_article_organization_name'];
|
298 |
+
}
|
299 |
+
if(isset($custom_fields['saswp_tech_article_organization_logo'])){
|
300 |
+
$input1['Publisher']['logo']['url'] = $custom_fields['saswp_tech_article_organization_logo'];
|
301 |
+
}
|
302 |
+
break;
|
303 |
|
304 |
case 'Recipe':
|
305 |
if(isset($custom_fields['saswp_recipe_url'])){
|
1077 |
);
|
1078 |
break;
|
1079 |
|
1080 |
+
case 'TechArticle':
|
1081 |
+
|
1082 |
+
$meta_field = array(
|
1083 |
+
'saswp_tech_article_main_entity_of_page' => 'Main Entity Of Page',
|
1084 |
+
'saswp_tech_article_image' => 'Image',
|
1085 |
+
'saswp_tech_article_headline' => 'Headline',
|
1086 |
+
'saswp_tech_article_description' => 'Description',
|
1087 |
+
'saswp_tech_article_date_published' => 'Date Published',
|
1088 |
+
'saswp_tech_article_date_modified' => 'Date Modified',
|
1089 |
+
'saswp_tech_article_author_name' => 'Author Name',
|
1090 |
+
'saswp_tech_article_organization_name' => 'Organization Name',
|
1091 |
+
'saswp_tech_article_organization_logo' => 'Organization Logo',
|
1092 |
+
);
|
1093 |
+
break;
|
1094 |
+
|
1095 |
case 'Recipe':
|
1096 |
|
1097 |
$meta_field = array(
|
1295 |
|
1296 |
switch ($schema_type) {
|
1297 |
|
1298 |
+
case 'TechArticle':
|
1299 |
+
|
1300 |
+
$input1 = array(
|
1301 |
+
'@context' => 'http://schema.org',
|
1302 |
+
'@type' => 'TechArticle',
|
1303 |
+
'mainEntityOfPage' => get_permalink(),
|
1304 |
+
'headline' => get_the_title(),
|
1305 |
+
'description' => strip_tags(get_the_excerpt()),
|
1306 |
+
'datePublished' => $date,
|
1307 |
+
'dateModified' => $modified_date,
|
1308 |
+
'author' => array(
|
1309 |
+
'@type' => 'Person',
|
1310 |
+
'name' => $aurthor_name
|
1311 |
+
),
|
1312 |
+
'Publisher' => array(
|
1313 |
+
'@type' => 'Organization',
|
1314 |
+
'logo' => array(
|
1315 |
+
'@type' => 'ImageObject',
|
1316 |
+
'url' => $logo,
|
1317 |
+
'width' => $width,
|
1318 |
+
'height' => $height,
|
1319 |
+
),
|
1320 |
+
'name' => $site_name,
|
1321 |
+
),
|
1322 |
+
|
1323 |
+
);
|
1324 |
+
|
1325 |
+
break;
|
1326 |
+
|
1327 |
case 'Article':
|
1328 |
|
1329 |
$input1 = array(
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
|
|
3 |
Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.0.2
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -65,6 +65,15 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
= 1.0.9 (07 February 2019) =
|
69 |
|
70 |
* New Feature: SiteNavigationElement schema type add to the schema type list #115
|
3 |
Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.0.2
|
6 |
+
Stable tag: 1.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.1 (15 February 2019) =
|
69 |
+
|
70 |
+
* New Feature: TechArticle schema type add to the schema type list #115
|
71 |
+
* Added: Show admin notice, when schema's default image is not set inside setting #145
|
72 |
+
* Bug Fixed: Schema markup is not getting author name from the post #146
|
73 |
+
* Bug Fixed: When Review and Article schema are enabled at the same time. There is a validation error in logo markup #141
|
74 |
+
* Bug Fixed: Image is not being fetched in local_business schema markup from local schema image field #135
|
75 |
+
|
76 |
+
|
77 |
= 1.0.9 (07 February 2019) =
|
78 |
|
79 |
* New Feature: SiteNavigationElement schema type add to the schema type list #115
|
structured-data-for-wp.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Schema & Structured Data for WP
|
4 |
Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
|
5 |
-
Version: 1.
|
6 |
Text Domain: schema-and-structured-data-for-wp
|
7 |
Domain Path: /languages
|
8 |
Author: Mohammed Kaludi, Ahmed Kaludi
|
@@ -13,7 +13,7 @@ License: GPL2
|
|
13 |
// Exit if accessed directly.
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
-
define('SASWP_VERSION', '1.
|
17 |
define('SASWP_DIR_NAME_FILE', __FILE__ );
|
18 |
define('SASWP_DIR_NAME', dirname( __FILE__ ));
|
19 |
define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
|
@@ -45,8 +45,10 @@ if ( ! function_exists('saswp_non_amp') ){
|
|
45 |
|
46 |
$non_amp = false;
|
47 |
|
48 |
-
}
|
|
|
49 |
return $non_amp;
|
|
|
50 |
}
|
51 |
|
52 |
}
|
@@ -130,11 +132,28 @@ function saswp_admin_notice(){
|
|
130 |
</div>
|
131 |
<?php
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
add_filter('plugin_row_meta' , 'saswp_add_plugin_meta_links', 10, 2);
|
136 |
|
137 |
function saswp_add_plugin_meta_links($meta_fields, $file) {
|
|
|
138 |
if ( plugin_basename(__FILE__) == $file ) {
|
139 |
$plugin_url = "https://wordpress.org/support/plugin/schema-and-structured-data-for-wp";
|
140 |
$hire_url = "https://ampforwp.com/hire/";
|
@@ -151,4 +170,5 @@ function saswp_add_plugin_meta_links($meta_fields, $file) {
|
|
151 |
}
|
152 |
|
153 |
return $meta_fields;
|
|
|
154 |
}
|
2 |
/*
|
3 |
Plugin Name: Schema & Structured Data for WP
|
4 |
Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
|
5 |
+
Version: 1.1
|
6 |
Text Domain: schema-and-structured-data-for-wp
|
7 |
Domain Path: /languages
|
8 |
Author: Mohammed Kaludi, Ahmed Kaludi
|
13 |
// Exit if accessed directly.
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
|
16 |
+
define('SASWP_VERSION', '1.1');
|
17 |
define('SASWP_DIR_NAME_FILE', __FILE__ );
|
18 |
define('SASWP_DIR_NAME', dirname( __FILE__ ));
|
19 |
define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
|
45 |
|
46 |
$non_amp = false;
|
47 |
|
48 |
+
}
|
49 |
+
|
50 |
return $non_amp;
|
51 |
+
|
52 |
}
|
53 |
|
54 |
}
|
132 |
</div>
|
133 |
<?php
|
134 |
}
|
135 |
+
|
136 |
+
if(isset($sd_data['sd_default_image']['url']) && $sd_data['sd_default_image']['url'] == ''){
|
137 |
+
|
138 |
+
?>
|
139 |
+
<div class="updated notice is-dismissible message notice notice-alt saswp-feedback-notice">
|
140 |
+
<p>
|
141 |
+
<span><?php echo esc_html__('You have not setup default image in Schema & Structured Data For WP.', 'schema-and-structured-data-for-wp') ?> </span>
|
142 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=structured_data_options&tab=schema' ) ); ?>"> <?php echo esc_html__('Please Setup', 'schema-and-structured-data-for-wp') ?></a>
|
143 |
+
</p>
|
144 |
+
</div>
|
145 |
+
|
146 |
+
|
147 |
+
<?php
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
}
|
152 |
|
153 |
add_filter('plugin_row_meta' , 'saswp_add_plugin_meta_links', 10, 2);
|
154 |
|
155 |
function saswp_add_plugin_meta_links($meta_fields, $file) {
|
156 |
+
|
157 |
if ( plugin_basename(__FILE__) == $file ) {
|
158 |
$plugin_url = "https://wordpress.org/support/plugin/schema-and-structured-data-for-wp";
|
159 |
$hire_url = "https://ampforwp.com/hire/";
|
170 |
}
|
171 |
|
172 |
return $meta_fields;
|
173 |
+
|
174 |
}
|
view/post_specific.php
CHANGED
@@ -335,6 +335,7 @@ class saswp_post_specific {
|
|
335 |
case 'media':
|
336 |
$media_value = array();
|
337 |
$media_key = $meta_field['id'].'_detail';
|
|
|
338 |
$media_value_meta = get_post_meta( $post->ID, $media_key, true );
|
339 |
if(!empty($media_value_meta)){
|
340 |
$media_value =$media_value_meta;
|
@@ -380,8 +381,8 @@ class saswp_post_specific {
|
|
380 |
if (strpos($meta_field['id'], 'review_schema_image') !== false && empty($media_value_meta)) {
|
381 |
|
382 |
$business_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
|
383 |
-
$media_value['height']
|
384 |
-
$media_value['width']
|
385 |
$media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
|
386 |
}
|
387 |
|
@@ -398,8 +399,7 @@ class saswp_post_specific {
|
|
398 |
if(isset($media_value['width'])){
|
399 |
$media_width =$media_value['width'];
|
400 |
}
|
401 |
-
|
402 |
-
|
403 |
$input = sprintf(
|
404 |
'<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
|
405 |
. '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
|
@@ -1356,6 +1356,65 @@ class saswp_post_specific {
|
|
1356 |
);
|
1357 |
break;
|
1358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1359 |
case 'Recipe':
|
1360 |
$meta_field = array(
|
1361 |
array(
|
335 |
case 'media':
|
336 |
$media_value = array();
|
337 |
$media_key = $meta_field['id'].'_detail';
|
338 |
+
|
339 |
$media_value_meta = get_post_meta( $post->ID, $media_key, true );
|
340 |
if(!empty($media_value_meta)){
|
341 |
$media_value =$media_value_meta;
|
381 |
if (strpos($meta_field['id'], 'review_schema_image') !== false && empty($media_value_meta)) {
|
382 |
|
383 |
$business_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
|
384 |
+
$media_value['height'] = $business_details['saswp_review_schema_image']['height'];
|
385 |
+
$media_value['width'] = $business_details['saswp_review_schema_image']['width'];
|
386 |
$media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
|
387 |
}
|
388 |
|
399 |
if(isset($media_value['width'])){
|
400 |
$media_width =$media_value['width'];
|
401 |
}
|
402 |
+
|
|
|
403 |
$input = sprintf(
|
404 |
'<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
|
405 |
. '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
|
1356 |
);
|
1357 |
break;
|
1358 |
|
1359 |
+
case 'TechArticle':
|
1360 |
+
$meta_field = array(
|
1361 |
+
array(
|
1362 |
+
'label' => 'Main Entity Of Page',
|
1363 |
+
'id' => 'saswp_tech_article_main_entity_of_page_'.$schema_id,
|
1364 |
+
'type' => 'text',
|
1365 |
+
'default' => get_permalink()
|
1366 |
+
),
|
1367 |
+
array(
|
1368 |
+
'label' => 'Image',
|
1369 |
+
'id' => 'saswp_tech_article_image_'.$schema_id,
|
1370 |
+
'type' => 'media',
|
1371 |
+
'default' => $image_details[0]
|
1372 |
+
),
|
1373 |
+
array(
|
1374 |
+
'label' => 'Headline',
|
1375 |
+
'id' => 'saswp_tech_article_headline_'.$schema_id,
|
1376 |
+
'type' => 'text',
|
1377 |
+
'default' => get_the_title()
|
1378 |
+
),
|
1379 |
+
array(
|
1380 |
+
'label' => 'Description',
|
1381 |
+
'id' => 'saswp_tech_article_description_'.$schema_id,
|
1382 |
+
'type' => 'textarea',
|
1383 |
+
'default' => $post->post_excerpt
|
1384 |
+
) ,
|
1385 |
+
array(
|
1386 |
+
'label' => 'Date Published',
|
1387 |
+
'id' => 'saswp_tech_article_date_published_'.$schema_id,
|
1388 |
+
'type' => 'text',
|
1389 |
+
'default' => get_the_date("Y-m-d")
|
1390 |
+
),
|
1391 |
+
array(
|
1392 |
+
'label' => 'Date Modified',
|
1393 |
+
'id' => 'saswp_tech_article_date_modified_'.$schema_id,
|
1394 |
+
'type' => 'text',
|
1395 |
+
'default' => get_the_modified_date("Y-m-d")
|
1396 |
+
),
|
1397 |
+
array(
|
1398 |
+
'label' => 'Author Name',
|
1399 |
+
'id' => 'saswp_tech_article_author_name_'.$schema_id,
|
1400 |
+
'type' => 'text',
|
1401 |
+
'default' => $current_user->display_name
|
1402 |
+
),
|
1403 |
+
array(
|
1404 |
+
'label' => 'Organization Name',
|
1405 |
+
'id' => 'saswp_tech_article_organization_name_'.$schema_id,
|
1406 |
+
'type' => 'text',
|
1407 |
+
'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
|
1408 |
+
),
|
1409 |
+
array(
|
1410 |
+
'label' => 'Organization Logo',
|
1411 |
+
'id' => 'saswp_tech_article_organization_logo_'.$schema_id,
|
1412 |
+
'type' => 'media',
|
1413 |
+
'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
|
1414 |
+
)
|
1415 |
+
);
|
1416 |
+
break;
|
1417 |
+
|
1418 |
case 'Recipe':
|
1419 |
$meta_field = array(
|
1420 |
array(
|
view/schema_type.php
CHANGED
@@ -655,7 +655,8 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
|
|
655 |
'qanda' => 'Q&A',
|
656 |
'Review' => 'Review',
|
657 |
'Recipe' => 'Recipe',
|
658 |
-
'Service' => 'Service',
|
|
|
659 |
'VideoObject' => 'VideoObject',
|
660 |
'WebPage' => 'WebPage'
|
661 |
);
|
@@ -1604,8 +1605,10 @@ function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
|
|
1604 |
$review_schema_details[$meta_field['id']] = $_POST[ $meta_field['id'] ];
|
1605 |
|
1606 |
|
1607 |
-
} else if ( $meta_field['type'] === 'checkbox' ) {
|
|
|
1608 |
$review_schema_details[$meta_field['id']] = '0';
|
|
|
1609 |
}
|
1610 |
}
|
1611 |
|
655 |
'qanda' => 'Q&A',
|
656 |
'Review' => 'Review',
|
657 |
'Recipe' => 'Recipe',
|
658 |
+
'Service' => 'Service',
|
659 |
+
'TechArticle' => 'TechArticle',
|
660 |
'VideoObject' => 'VideoObject',
|
661 |
'WebPage' => 'WebPage'
|
662 |
);
|
1605 |
$review_schema_details[$meta_field['id']] = $_POST[ $meta_field['id'] ];
|
1606 |
|
1607 |
|
1608 |
+
} else if ( $meta_field['type'] === 'checkbox' ) {
|
1609 |
+
|
1610 |
$review_schema_details[$meta_field['id']] = '0';
|
1611 |
+
|
1612 |
}
|
1613 |
}
|
1614 |
|