schema.org attributes
-
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
- The topic ‘schema.org attributes’ is closed to new replies.