WordPress.org

Forums

Custom breadcrumbs with Google Rich format for WordPress (1 post)

  1. zecke
    Member
    Posted 2 years ago #

    Hi

    I got this code for breadcrumbs on single posts:

    <div xmlns:v="http://rdf.data-vocabulary.org/#">
    
    <span typeof="v:Breadcrumb"><a href="<?php echo $site_url = network_site_url( '/' ); '' . $site_url; ?>" rel="v:url" property="v:title"><?php $find = 'http://'; $replace = '';echo str_replace($find,$replace,get_bloginfo(url));?></a></span> »
    
    <span typeof="v:Breadcrumb"><a href="<?php bloginfo('url'); ?>/<?php $category = get_the_category(); echo $category[0]->category_nicename; ?>/" rel="v:url" property="v:title"><?php $current_cat_id =the_category_ID(false);echo get_cat_name($current_cat_id); ?></a></span>  »
    
    <span rel="v:child"><span typeof="v:Breadcrumb"><a href="<?php global $post; $slug = get_post( $post )->post_name; ?>" rel="v:url" property="v:title"><?php the_title(); ?></a></span></span>
    </div>

    This code is giving me great breadcrumbs onsite:

    domain.com -> category name -> post name

    But in the Google serps it`s look like this:

    domain.com -> post name -> category name

    Do You know what should I do to make it correctly ?

    When Im changing the child property, suddelny my tich formatting are gone (im looking to rich format testing tool)

    Thanks for any ideas

Topic Closed

This topic has been closed to new replies.

About this Topic