Changeset 2279121
- Timestamp:
- 04/08/2020 09:25:49 AM (6 years ago)
- Location:
- wp-covid-19-schema/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wp-covid19-schema.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-covid-19-schema/trunk/readme.txt
r2270735 r2279121 3 3 Tags: schema markup, structured data, rich snippets, schema.org, Microdata, schema 4 4 Requires at least: 3.0 5 Tested up to: 5. 35 Tested up to: 5.4 6 6 Requires PHP: 5.3 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 52 52 == Changelog == 53 53 54 = 1.0.2 = 55 56 * Bug Fixes 57 54 58 = 1.0.1 = 55 59 -
wp-covid-19-schema/trunk/wp-covid19-schema.php
r2270742 r2279121 6 6 * Author URI: https://sweans.com 7 7 * Description: WP COVID-19 Schema plugin adds a schema snippet in the WordPress websites of schools and hospitals to serve the specific purpose of announcements. 8 * Version: 1.0. 18 * Version: 1.0.2 9 9 * Text Domain: wp-covid-schema 10 10 * License: GPL3 … … 43 43 44 44 if (!function_exists('swwpcs_hook_schema')) { 45 45 46 function swwpcs_hook_schema() { 46 47 47 48 $show_schema = false; 48 49 $schema_control = get_option('swwpcs_schema_control'); 49 if($schema_control == "all" || ( $schema_control == "home" && ( is_home() || is_front_page())) || ( ( $schema_control == "post" || $schema_control == "page" ) && ( get_the_ID() == get_option('swwpcs_schema_page_post_id') ) )) { ?> 50 <!-- Schema added by WP COVID-19 Schema Plugin --> 51 <script type="application/ld+json"> 52 { 53 "@context": "http://schema.org", 54 "@type": "SpecialAnnouncement", 55 "name": "<?php echo get_option('swwpcs_name'); ?>", 56 "text": "<?php echo get_option('swwpcs_text'); ?>", 57 "datePosted": "<?php echo get_option('swwpcs_date_posted'); ?>", 58 "url": "<?php echo get_option('swwpcs_article_url'); ?>", 59 "category": "https://www.wikidata.org/wiki/Q81068910", 60 "about" : { 61 "@type": "CovidTestingFacility", 62 "name": "<?php echo get_option('swwpcs_testing_facility_name'); ?>", 63 "url": "<?php echo get_bloginfo('url'); ?>" 50 51 if($schema_control == "all" || ( $schema_control == "home" && ( is_home() || is_front_page())) || ( ( $schema_control == "post" || $schema_control == "page" ) && ( get_the_ID() == get_option('swwpcs_schema_page_post_id') ) )) { 52 53 $markup = '<!-- Schema added by WP COVID-19 Schema Plugin -->'; 54 $markup .= '<script type="application/ld+json">'; 55 $markup .= swwpcs_get_json_data(); 56 $markup .= '</script>'; 57 $markup .= '<!-- / Schema added by WP COVID-19 Schema Plugin -->'; 58 59 echo $markup; 60 61 } 62 64 63 } 65 } 66 </script> 67 <!-- / Schema added by WP COVID-19 Schema Plugin --> 68 <?php } 69 } 64 70 65 } 71 66 … … 105 100 } 106 101 } 102 103 if (!function_exists('swwpcs_get_json_data')) { 104 function swwpcs_get_json_data(){ 105 $array = [ 106 '@context' => 'http://schema.org', 107 '@type' => 'SpecialAnnouncement', 108 'name' => esc_html(get_option('swwpcs_name')), 109 'text' => esc_html(get_option('swwpcs_text')), 110 'datePosted' => esc_html(get_option('swwpcs_date_posted')), 111 'url' => esc_html(get_option('swwpcs_article_url')), 112 'category' => 'https://www.wikidata.org/wiki/Q81068910', 113 'about' => array( 114 '@type' => "CovidTestingFacility", 115 'name' => esc_html(get_option('swwpcs_testing_facility_name')), 116 'url' => esc_html(get_bloginfo('url')) 117 ) 118 ]; 119 120 return wp_json_encode($array); 121 122 } 123 }
Note: See TracChangeset
for help on using the changeset viewer.