Black Friday hosting deals · every offer with its renewal price

// wordpress & cpanel how-tos

How to add Yoast breadcrumbs to X Theme by Themeco

Breadcrumbs help visitors and search engines understand your site. If you use X Theme by Themeco, adding Yoast's breadcrumbs takes one small function in your child theme. Here's how, step by step.

Before you start

Even if your theme has its own breadcrumbs, Yoast's are simple, clean and add breadcrumb structured data for search results. X Theme users find it a little confusing to add the code, so I'll make it clear.

You need access to File Manager in cPanel or an FTP client like FileZilla. Back up your themes folder first: compress it and download it. Don't edit the file from the WordPress admin area: if you make a mistake while pasting, you can lock yourself out of your site. FTP, or better SFTP, is safer.

Always add custom code to a child theme, never to the parent theme. Code you add to the parent is lost at the next theme update, while changes in the child theme stay.

Add the breadcrumbs code

  1. In cPanel, open File Manager and click public_html.
  2. Open wp-content, which holds your plugins, themes and uploads, then themes.
  3. Open your X child theme folder.
  4. Select functions.php and click Edit. In FileZilla, right-click the file and choose View/Edit; after saving, FileZilla asks to upload the file back to the server.
  5. Paste this code at the bottom of the file and save:
if ( ! function_exists( 'x_breadcrumbs' ) ) :
  function x_breadcrumbs() {
    if ( x_get_option( 'x_breadcrumb_display', 1 ) && function_exists( 'yoast_breadcrumb' ) ) {
      yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' );
    }
  }
endif;

Make sure breadcrumbs are enabled in Yoast SEO's settings, then open any post on your site and check that they appear. Clear your WordPress cache too, so you don't see an old cached page without the change.

Other themes

This method works for many WordPress themes, not only X. I used X as the example, so check your own theme's documentation for the name of its breadcrumbs function before you replace it.

FAQ

Do I need a child theme to add Yoast breadcrumbs?

Yes, if you edit theme files. Code added to the parent theme's functions.php is lost when the theme updates. A child theme keeps your changes through updates.

Why don't my Yoast breadcrumbs show after adding the code?

Check that breadcrumbs are enabled in Yoast SEO's settings, that the code is in the active child theme's functions.php, and clear your caching plugin and browser cache. Your theme must also call its breadcrumbs function where they should appear.

Keep reading

WRITTEN BY

Fathi Arfaoui

Fathi Arfaoui has helped people choose web hosting, start blogs and build WordPress sites since 2013. He founded SiteHostingFinder to replace opinion-based hosting reviews with real prices and public data. He has been a HostGator customer since 2013 and has hosted 40-50 WordPress sites on Pressable since 2017.