Plugin Directory

Changeset 2309953


Ignore:
Timestamp:
05/22/2020 05:39:05 AM (6 years ago)
Author:
milanmk
Message:

Release 1.15.4

Location:
schema-app-structured-data-for-schemaorg
Files:
26 added
4 edited

Legend:

Unmodified
Added
Removed
  • schema-app-structured-data-for-schemaorg/trunk/hunch-schema.php

    r2295483 r2309953  
    55 * Plugin URI: http://www.schemaapp.com
    66 * Description: This plugin adds http://schema.org structured data to your website
    7  * Version: 1.15.3
     7 * Version: 1.15.4
    88 * Author: Hunch Manifest
    99 * Author URI: https://www.hunchmanifest.com
  • schema-app-structured-data-for-schemaorg/trunk/lib/HunchSchema/Page.php

    r2074727 r2309953  
    6060
    6161
    62     public function getBreadcrumb( $Pretty = false )
    63     {
     62    public function getBreadcrumb( $Pretty = false ) {
    6463        global $post;
    6564
    66         $BreadcrumbPosition = 1;
    67         $this->SchemaBreadcrumb['@context'] = 'http://schema.org';
    68         $this->SchemaBreadcrumb['@type'] = 'BreadcrumbList';
     65        $position                           = 1;
     66        $this->SchemaBreadcrumb['@context'] = 'http://schema.org';
     67        $this->SchemaBreadcrumb['@type']    = 'BreadcrumbList';
    6968
    70         $this->SchemaBreadcrumb['itemListElement'][] = array
    71         (
    72             '@type' => 'ListItem',
    73             'position' => $BreadcrumbPosition++,
    74             'item' => array
    75             (
    76                 '@id' => home_url( '/#breadcrumbitem' ),
    77                 'name' => get_bloginfo( 'name' ),
    78             ),
    79         );
     69        if ( $post->post_parent ) {
     70            $post_ancestors = array_reverse( get_post_ancestors( $post->ID ) );
    8071
    81         if ( $post->post_parent )
    82         {
    83             $Ancestors = array_reverse( get_post_ancestors( $post->ID ) );
    84 
    85             foreach( $Ancestors as $PostId )
    86             {
    87                 $this->SchemaBreadcrumb['itemListElement'][] = array
    88                 (
     72            foreach( $post_ancestors as $post_id ) {
     73                $this->SchemaBreadcrumb['itemListElement'][] = array(
    8974                    '@type' => 'ListItem',
    90                     'position' => $BreadcrumbPosition++,
    91                     'item' => array
    92                     (
    93                         '@id' => get_permalink( $PostId ) . "#breadcrumbitem",
    94                         'name' => get_the_title( $PostId ),
    95                     ),
     75                    'position' => $position++,
     76                    'name' => get_the_title( $post_id ),
     77                    'item' => get_permalink( $post_id ) . "#breadcrumbitem",
    9678                );
    9779            }
    9880        }
    9981
    100                 if ( ! is_front_page() ) {
    101                     $this->SchemaBreadcrumb['itemListElement'][] = array
    102                     (
    103                             '@type' => 'ListItem',
    104                             'position' => $BreadcrumbPosition++,
    105                             'item' => array
    106                             (
    107                                     '@id' => get_permalink() . "#breadcrumbitem",
    108                                     'name' => get_the_title(),
    109                             ),
    110                     );
    111                 }
     82        if ( ! is_front_page() ) {
     83            $this->SchemaBreadcrumb['itemListElement'][] = array(
     84                '@type' => 'ListItem',
     85                'position' => $position++,
     86                'name' => get_the_title(),
     87                'item' => get_permalink() . '#breadcrumbitem',
     88            );
     89        } else {
     90            return;
     91        }
    11292
    11393        return $this->toJson( $this->SchemaBreadcrumb, $Pretty );
  • schema-app-structured-data-for-schemaorg/trunk/lib/HunchSchema/Post.php

    r2153620 r2309953  
    4242
    4343
    44     public function getBreadcrumb( $Pretty = false )
    45     {
    46         $BreadcrumbPosition = 1;
     44    public function getBreadcrumb( $Pretty = false ) {
     45        $position                           = 1;
     46        $permalink_structure                = get_option( 'permalink_structure' );
     47        $this->SchemaBreadcrumb['@context'] = 'http://schema.org/';
     48        $this->SchemaBreadcrumb['@type']    = 'BreadcrumbList';
    4749
    48         $this->SchemaBreadcrumb['@context'] = 'http://schema.org/';
    49         $this->SchemaBreadcrumb['@type'] = 'BreadcrumbList';
     50        if ( $permalink_structure ) {
     51            $permalink_host         = stristr( get_permalink(), parse_url( get_permalink(), PHP_URL_PATH ), true );
     52            $permalink_path_parts   = array_values( array_filter( explode( '/', parse_url( get_permalink(), PHP_URL_PATH ) ) ) );
    5053
    51         $this->SchemaBreadcrumb['itemListElement'][] = array
    52         (
     54            if ( ! empty( $permalink_path_parts ) ) {
     55                array_pop( $permalink_path_parts );
     56            }
     57
     58            if ( ! empty( $permalink_path_parts ) ) {
     59                $breadcrumb_permalink = $permalink_host;
     60
     61                foreach ( $permalink_path_parts as $item ) {
     62                    $breadcrumb_permalink .= "/{$item}/";
     63
     64                    $this->SchemaBreadcrumb['itemListElement'][] = array(
     65                        '@type' => 'ListItem',
     66                        'position' => $position,
     67                        'name' => ucwords( str_replace( '-', ' ', $item ) ),
     68                        'item' => $breadcrumb_permalink . '#breadcrumbitem',
     69                    );
     70
     71                    $position++;
     72                }
     73            }
     74        }
     75
     76        $this->SchemaBreadcrumb['itemListElement'][] = array(
    5377            '@type' => 'ListItem',
    54             'position' => $BreadcrumbPosition++,
    55             'item' => array
    56             (
    57                 '@id' => home_url( '/#breadcrumbitem' ),
    58                 'name' => get_bloginfo( 'name' ),
    59             ),
    60         );
    61 
    62         $this->SchemaBreadcrumb['itemListElement'][] = array
    63         (
    64             '@type' => 'ListItem',
    65             'position' => $BreadcrumbPosition++,
    66             'item' => array
    67             (
    68                 '@id' => get_permalink() . "#breadcrumbitem",
    69                 'name' => get_the_title(),
    70             ),
     78            'position' => $position++,
     79            'name' => get_the_title(),
     80            'item' => get_permalink() . '#breadcrumbitem',
    7181        );
    7282
  • schema-app-structured-data-for-schemaorg/trunk/readme.txt

    r2295483 r2309953  
    99Requires PHP: 5.4
    1010Tested up to: 5.4
    11 Stable tag: 1.15.3
     11Stable tag: 1.15.4
    1212License: GPL2
    1313License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8787== Changelog ==
    8888
     89= 1.15.4 =
     90- Fix, Updated BreadcrumbList markup based on Google's schema
     91
    8992= 1.15.3 =
    9093- Fix, hunch_schema_meta_box_post_types filter error
     
    410413== Upgrade Notice ==
    411414
    412 = 1.15.3 =
    413 - Added back global options for Post/Page schema markup, CPT filter for schema metabox, Vimeo private video issue
     415= 1.15.4 =
     416- Updated BreadcrumbList markup based on Google's schema
Note: See TracChangeset for help on using the changeset viewer.