{"id":22991,"date":"2012-02-27T21:48:06","date_gmt":"2012-02-27T16:18:06","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/?p=22991"},"modified":"2020-07-10T10:45:28","modified_gmt":"2020-07-10T05:15:28","slug":"wordpress-seo-breadcrumbs","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2012\/02\/wordpress-seo-breadcrumbs\/","title":{"rendered":"How to Create WordPress SEO Breadcrumbs"},"content":{"rendered":"<p>How can you create <strong>WordPress\u00a0SEO friendly breadcrumbs code<\/strong> which displays more links in your search results and can get you extra free search engine traffic. Since Google introduced rich snippets in Google search results, webmasters have an option to enhance their Google visibility easily by implementing this feature.<\/p>\n<p>See how our Google search results display Breadcrumbs, which provides more clickable green links below post title for visitors to click directly into our categories for extra search engine traffic.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-24553\" title=\"search-breadcrumbs\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/search-breadcrumbs.png\" alt=\"search breadcrumbs\" width=\"366\" height=\"78\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/search-breadcrumbs.png 366w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/search-breadcrumbs-150x31.png 150w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/search-breadcrumbs-300x63.png 300w\" sizes=\"(max-width: 366px) 100vw, 366px\" \/><\/p>\n<p>Breadcrumbs is the link trail you see on top of many web pages which defines site structure. Many new rich snippets are possible with\u00a0<a href=\"http:\/\/schema.org\/WebPage\" target=\"_blank\" rel=\"noopener noreferrer\">schema.org implementation<\/a>, which allows webmasters to implement code which allows search engines to understand your breadcrumbs and display them in results. <a href=\"http:\/\/support.google.com\/webmasters\/bin\/answer.py?hl=en&amp;answer=185417\" target=\"_blank\" rel=\"noopener noreferrer\">Google Webmasters advises <\/a>that the code is very strict, can be implemented in Microdata or RDFa format, and unless you get it all right, it will not work.<\/p>\n<div class=\"entry-content-asset videofit\"><iframe title=\"Introduction to Rich Snippets\" width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/A-kX0Aut-18?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<h2>Step 1: Breadcrumbs Code<\/h2>\n<p>In WordPress, check out your theme<strong> functions.php<\/strong> file and add the following code. If you don&#8217;t have one in your theme, you can create it and upload to your themes folder.<\/p>\n<p><strong><span style=\"color: #ff0000;\">Warning<\/span><\/strong>: Be warned that this file if not saved properly with proper PHP tags, <span style=\"text-decoration: underline;\"><em>will<\/em><\/span> make your site go offline and you will need to FTP inside your server and edit the file to original if something goes wrong. So save a backup copy of this file, or test it on a test blog before\u00a0implementing\u00a0this.<\/p>\n<p>Here is code you need to add to the theme functions.php file<\/p>\n<pre>&lt;?php\r\nif ( ! function_exists( 'seobreadcrumbs' ) ) :\r\nfunction seobreadcrumbs() {\r\n  $separator = '&amp;rsaquo;';\r\n  $home = 'Home';\r\n  echo '&lt;div xmlns:v=\"http:\/\/rdf.data-vocabulary.org\/#\" class=\"seobreadcrumbs\"&gt;';\r\nglobal $post;\r\n  echo '\u00a0 &lt;span typeof=\"v:Breadcrumb\"&gt;\r\n  &lt;a rel=\"v:url\" property=\"v:title\" href=\"YOUR-BLOG-URL\"&gt;Home&lt;\/a&gt;\r\n  &lt;\/span&gt; ';\r\n $category = get_the_category();\r\n    if ($category) {\r\n    foreach($category as $category) {\r\n    echo $separator . \"&lt;span typeof=\"v:Breadcrumb\"&gt;\r\n    &lt;a rel=\"v:url\" property=\"v:title\" href=\"\".get_category_link($category-&gt;term_id).\"\" &gt;$category-&gt;name&lt;\/a&gt;\r\n    &lt;\/span&gt;\";\r\n}\r\n}\r\n  echo '&lt;\/div&gt;';\r\n}\r\nendif;\r\n?&gt;<\/pre>\n<p><span style=\"text-decoration: underline;\">Note 1:<\/span> If you already have a theme functions.php file with lots of code, then you do NOT need to add the php opening and closing tags (first and last line of the code) as they will already be present. Its a good practice to clearly mark the code with comments, so you know where the breadcrumbs code starts and ends should you need to edit it later.<\/p>\n<p><span style=\"text-decoration: underline;\">Note 2:<\/span> You need to replace YOUR-BLOG-URL with your full domain name url (including http:\/\/). The Separator is set to display a &gt; between the breadcrumbs, you can always change that to what you like, but Google search results display this so it is good idea to keep \u00a0it that way.<\/p>\n<h2>Step 2: Add Breadcrumbs to Theme Template<strong><br \/>\n<\/strong><\/h2>\n<p>Now in your template wherever you want to use the SEO breadcrumbs, you can install the following code. Typically you need to install in in your\u00a0WordPress\u00a0theme single.php file above the post title.<\/p>\n<p><code>&lt;?php seobreadcrumbs(); ?&gt;<\/code><\/p>\n<p>Its easy to style the breadcrumbs by editing your CSS file. Note the code uses the class .seobreadcrumbs &#8211; \u00a0so simply using the CSS class you can see how the web design appears. For example, the following CSS will make your breadcrumbs font smaller. You can easily change the placement, link colors etc by editing the CSS.<\/p>\n<p><code>.seobreadcrumbs {font-size:0.8 em; }<\/code><\/p>\n<h2>Step 3: Test Breadcrumbs<\/h2>\n<p>Once you have implemented this, you can use the <a href=\"https:\/\/search.google.com\/structured-data\/testing-tool\" target=\"_blank\" rel=\"noopener noreferrer\">Rich Snippets testing tool<\/a> to test your url. Google will crawl your pages typically over a few weeks and you can see breadcrumbs\u00a0appearing\u00a0in your site search results. To see which urls are getting the rich snippets, search for site:yourdomainname.com and behold.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can you create WordPress\u00a0SEO friendly breadcrumbs code which displays more links in your search results and can get you&#8230;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6,41],"tags":[49,17],"class_list":["post-22991","post","type-post","status-publish","format-standard","hentry","category-blogging","category-search-engine-optimization","tag-tutorials","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/22991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=22991"}],"version-history":[{"count":0,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/22991\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=22991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=22991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=22991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}