Missing field “item” – error in Google webmaster
-
Hey guys! Could you help me to find it out. Swearing at a chain of crumbs, maybe I lost sight of something.
Missing field “item” – error in Google webmaster
Swearing at this piece of code:
<li itemprop=”itemListElement” itemscope itemtype=”https://schema.org/ListItem” class=”trail-item trail-begin”><span itemprop=”name”>Main</span><meta itemprop=”position” content=”1″ />
The code in the template is:
// Open the unordered list.
$breadcrumb .= ‘<ul class=”trail-items” itemscope itemtype=”https://schema.org/BreadcrumbList”>’;// Add the number of items and item list order schema.
$breadcrumb .= sprintf( ‘<meta name=”numberOfItems” content=”%d” />’, absint( $item_count ) );
$breadcrumb .= ‘<meta name=”itemListOrder” content=”Ascending” />’;// Loop through the items and add them to the list.
foreach ( $this->items as $item ) {// Iterate the item position.
++$item_position;// Check if the item is linked.
preg_match( ‘/(<a.*?>)(.*?)(<\/a>)/i’, $item, $matches );// Wrap the item text with appropriate itemprop.
$item = !empty( $matches ) ? sprintf( ‘%s<span itemprop=”name”>%s</span>%s’, $matches[1], $matches[2], $matches[3] ) : sprintf( ‘<span itemprop=”name”>%s</span>’, $item );// Add list item classes.
$item_class = ‘trail-item’;if ( 1 === $item_position && 1 < $item_count )
$item_class .= ‘ trail-begin’;elseif ( $item_count === $item_position )
$item_class .= ‘ trail-end’;// Create list item attributes.
$attributes = ‘itemprop=”itemListElement” itemscope itemtype=”https://schema.org/ListItem” class=”‘ . $item_class . ‘”‘;// Build the meta position HTML.
$meta = sprintf( ‘<meta itemprop=”position” content=”%s” />’, absint( $item_position ) );// Build the list item.
$breadcrumb .= sprintf( ‘<li %s>%s%s‘, $attributes, $item, $meta );
}// Close the unordered list.
$breadcrumb .= ‘‘;Help me to find it out where to fix something?
The page I need help with: [log in to see the link]
- The topic ‘Missing field “item” – error in Google webmaster’ is closed to new replies.