Changeset 2453124
- Timestamp:
- 01/09/2021 02:19:42 PM (5 years ago)
- Location:
- schema-breadcrumbs
- Files:
-
- 6 added
- 2 edited
-
tags/1.8 (added)
-
tags/1.8/WDPanelAdmin.css (added)
-
tags/1.8/WDPanelAdmin.php (added)
-
tags/1.8/readme.txt (added)
-
tags/1.8/schema-breadcrumbs.php (added)
-
tags/1.8/script_link.png (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/schema-breadcrumbs.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
schema-breadcrumbs/trunk/readme.txt
r2451981 r2453124 5 5 Requires at least: 2.2 6 6 Tested up to: 5.6 7 stable tag: 1. 77 stable tag: 1.8 8 8 9 9 Very easily add breadcrumbs to your site with valid Schema Breadcrumb Markup, this plugin is also a drop-in replacement for RDFa Breadcrumb, just install this and deactivate RDFa Breadcrumb. … … 31 31 32 32 == Changelog == 33 34 = 1.8 = 35 * Fixed issue with categories schema 33 36 34 37 = 1.6 = -
schema-breadcrumbs/trunk/schema-breadcrumbs.php
r2451981 r2453124 3 3 Plugin URI: http://webdesires.co.uk 4 4 Description: Outputs a fully Schema valid breadcrumb 5 Version: 1. 75 Version: 1.8 6 6 Author: Dean Williams 7 7 Author URI: http://deano.me … … 280 280 281 281 $parent = &get_category($id); 282 $parent_id = $id; 282 283 if ( is_wp_error( $parent ) ) 283 284 return $parent; … … 292 293 293 294 $chain[] = ($name); 295 296 //print_r($parent); 297 298 do { 299 $parent = &get_category($parent_id); 300 301 $actual_link = explode('?', "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); 302 $schema[] = '{ 303 "@type": "ListItem", 304 "position": '.(count($schema)+1).', 305 "item": 306 { 307 "@id": "'.get_category_link($parent->cat_ID).'", 308 "url": "'.get_category_link($parent->cat_ID).'", 309 "name": "'.$parent->name.'" 310 } 311 }'; 312 313 $parent_id = $parent->parent; 314 } while($parent_id > 0); 315 294 316 return $chain; 295 317 } … … 597 619 $schema[] = $homelinkschema; 598 620 $output[] = $homelink; 599 $output[] = schema_get_category_parents($cat, false); 621 $output = array_merge($output, schema_get_category_parents($cat, false)); 622 600 623 } elseif ( get_post_type() == 'product' ) { 601 624 $actual_link = explode('?', "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); … … 704 727 705 728 $html = ''; 729 706 730 foreach ($output as $key => $out) { 707 731 /* if (count($output) == $key+1) { … … 723 747 if (count($output) == $key+1) { 724 748 725 $actual_link = explode('?', "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); 726 $actual_link = $actual_link[0]; 727 $schema[] = '{ 749 if (count($output) > count($schema)) { 750 $actual_link = explode('?', "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); 751 $actual_link = $actual_link[0]; 752 $schema[] = '{ 728 753 "@type": "ListItem", 729 754 "position": '.(count($schema)+1).', … … 732 757 "@id": "'.$actual_link.'", 733 758 "url": "'.$actual_link.'", 734 "name": " '.get_the_title().'"759 "name": "1'.get_the_title().'" 735 760 } 736 761 }'; 762 } 737 763 738 764 if ($opt['boldlast']) {
Note: See TracChangeset
for help on using the changeset viewer.