The default settings for Breadcrumb NavXT are schema.org BreadcrumbList compliant, you shouldn’t need to modify them. That said, if you want to use li wrappers, it is probably better to use bcn_display_list rather than bcn_display.
The reason the setting won’t save is likely due to something in the li element not being whitelisted when it is run through wp_kses. You can add support for this element and various attributes by writing a filter for the bcn_allowed_html hook. See https://mtekk.us/archives/guides/how-to-add-li-and-other-tags-to-breadcrumb-templates/ for an example of how to do this.
Hi, Thanks for your reply.
Perhaps I’m doing something wrong, but your plugin does not include either of these lines of code in the output by default:
RDFa
<ol vocab="http://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
I’m having to wrap bcn_display() in an <ol> with the schema code like so:
<ol class="breadcrumbs mb50" vocab="http://schema.org/" typeof="BreadcrumbList">
<?php bcn_display($return = false, $linked = true, $reverse = false, $force = false); ?>
</ol>
But Google is still saying this:
A value for the itemListElement field is required.
So I guess if I could add something to stop stripping out the <li> attributes that would solve all my problems. I just don’t know exactly how I would go about adding a filter to stop stripping out the following code:
<li property="itemListElement" typeof="ListItem">
Can you help me with this please?
Thanks
Don’t worry this sorted it, like you previously suggested:
/* Allow extra tags in <li> */
function scratch_bcn_allowed_html($allowed_html){
$allowed_html['li'] = array(
'property' => true,
'typeof' => true
);
return $allowed_html;
}
add_filter('bcn_allowed_html', 'scratch_bcn_allowed_html');
I am then using this for all linked breadcrumbs:
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="%link%" class="%type%">
<span property="name">Home</span>
</a>
<meta property="position" content="%position%">
</li>
And this for all unlinked:
<li>
<span>%htitle%</span>
<meta content="%position%">
</li>
Thanks