Hi, suddenly, I think since updating to WordPress 4.7, I’m getting this error on blog posts:
Warning: Illegal string offset ‘taxonomy’ in /home/xxx/mysite.com/wp-includes/taxonomy.php on line 1874
Warning: Illegal string offset ‘object_ids’ in /home/xxx/mysite.com/wp-includes/taxonomy.php on line 1875
Warning: array_pop() expects parameter 1 to be array, object given in /home/xxx/mysite.com/wp-content/plugins/carbon-breadcrumbs/core/Carbon_Breadcrumb_Trail_Setup.php on line 135
It appears before the breadcrumb. All other pages are fine.
As I said, I think since 4.7, but I’m unsure, my site is still in development and I haven’t visited my blog posts for a while.
A brand new post adds an additional error:
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/xxx/mysite.com/wp-content/plugins/carbon-breadcrumbs/core/Carbon_Breadcrumb_Item_Renderer.php on line 112
Hi, you’ve saved me from terrible things. I was stymied by Woocommerce’s lack of duplicate slugs in categories. My work around was to use Permalinks Customizer and tags. All was well but I couldn’t find a breadcumbs that worked with this method of creating permalinks.
Yours did with a this in my functions:
# Add a new page item and its ancestry
add_action('carbon_breadcrumbs_after_setup_trail', 'crb_add_test_page_item');
function crb_add_test_page_item($trail)
{
if (is_product())
{
$terms = get_the_terms($post->ID, 'product_tag');
foreach($terms as $term)
{
if ($term->slug == 't4-76-1st')
{
$locator = Carbon_Breadcrumb_Locator::factory('post', 'page');
$priority = 500;
$page_id = 1497;
$items = $locator->get_items($priority, $page_id);
if ($items)
{
$trail->add_item($items);
}
}
if ($term->slug == 't4-35-1st')
{
$locator = Carbon_Breadcrumb_Locator::factory('post', 'page');
$priority = 500;
$page_id = 1496;
$items = $locator->get_items($priority, $page_id);
if ($items)
{
$trail->add_item($items);
}
}
if ($term->slug == 't2-76-1st')
{
$locator = Carbon_Breadcrumb_Locator::factory('post', 'page');
$priority = 500;
$page_id = 1499;
$items = $locator->get_items($priority, $page_id);
if ($items)
{
$trail->add_item($items);
}
}
if ($term->slug == 't2-35-1st')
{
$locator = Carbon_Breadcrumb_Locator::factory('post', 'page');
$priority = 500;
$page_id = 1498;
$items = $locator->get_items($priority, $page_id);
if ($items)
{
$trail->add_item($items);
}
}
}
}
}
Marvellous! Thank you ??
However…
I can’t seem to make schema.org attributes work.
For example, I have ol vocab=”https://schema.org/” typeof=”BreadcrumbList” in my ‘wrapper before’ in the ‘general settings’ page. But, I’m just seeing ol and no attributes. It’s the same with ‘title before’ <span property=”name”> coming out as just <span>.
Also, I’m trying to add attributes to each link in the breadcrumbs, also in my functions.php
add_action('carbon_breadcrumbs_item_attributes', 'crb_carbon_breadcrumbs_item_attributes');
function crb_carbon_breadcrumbs_item_attributes($attributes) {
$attributes = array(
'target' => '_blank',
'property' => 'item',
'typeof' => 'WebPage',
'class' => 'foobartwo'
);
return $attributes;
}
The ‘target’ attribute will change, as will class, but I’m not adding my property nor my typeof. This is probably because I’m an idiot.
Hope you can help,
Be happy for ever,
Steve