Google Warning For Osclass

Hi guys, just starting to see these warnings from google regarding the breadcrumb set up in osclass specifically: “data-vocabulary.org schema deprecated” and wondered if there was a way to fix the deprecated code?

oc-includes/osclass/classes/Breadcrumb.php, breadcrumb HTML must be edited to comply with new Schema markup.

From my theme:

<nav class="bread bg-darker">
    <div class="container">
        <ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
            <?php $i = 0; ?>
            <?php foreach($data as $page) { ?>
                <?php $i++; ?>
                <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                    <a itemprop="item" href="<?php echo (array_key_exists('url', $page)) ? $page['url'] : '#'; ?>"><span itemprop="name"><?php echo $page['title']; ?></span></a>
                    <meta itemprop="position" content="<?php echo $i; ?>" />
                </li>
            <?php } ?>
        </ol>
    </div>
</nav>

Thanks for this however, I cannot find the html code to replace inside oc-includes/osclass/classes/Breadcrumb.php anywhere.

Where is the code added to the page?
Was it replaced instead of what?

That was just an example on how the markup should look.
Replace the “render” function with this. Adjust it based on your themes.

    public function render($separator = '&raquo;')
    {
        if( count($this->aLevel) == 0 ) {
            return '';
        }

        $node = array();
        for($i = 0; $i < count($this->aLevel); $i++) {
            $text = '<li ';
            // set a class style for first and last <li>
            if( $i == 0 ) {
                $text .= 'class="first-child" ';
            }
            if( ($i == (count($this->aLevel) - 1)) && ($i != 0) ) {
                $text .= 'class="last-child" ';
            }
            $text .='itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';
            // set separator
            if( $i > 0 ) {
                $text .= ' ' . $separator . ' ';
            }
            // create span tag
            $title = '<a itemprop="item" href="#"><span itemprop="name">' . $this->aLevel[$i]['title'] . '</span></a>';
            if( array_key_exists('url', $this->aLevel[$i]) ) {
                $title = '<a itemprop="item" href="' . osc_esc_html($this->aLevel[$i]['url']) . '" itemprop="url"><span itemprop="name">' . $title . '</span></a>';
            }
            $meta = '<meta itemprop="position" content="' . $i . '" />';
            $node[] = $text . $title . $meta . '</li>' . PHP_EOL;
        }

        $result  = '<ul class="breadcrumb">' . PHP_EOL;
        $result .= implode(PHP_EOL, $node);
        $result .= '</ul>' . PHP_EOL;

        return $result;
    }

Thanks for this clarification.
The only difference I can see is this link: http://schema.org/ListItem

So I changed it inside the core oc-includes/osclass/classes/Breadcrumb.php file and inside my theme which is Cartegena: oc-content\themes\cartagena\classes\BreadcrumpCartagena.php both of which had this link referenced: http://data-vocabulary.org/Breadcrumb

Than clicked the re-validate button and google has now marked it as pending until google can confirm changes. Hopefully I am understanding this correctly.

1 Like