دسته‌ها
PHP WordPress آموزشی اسنیپت برنامه‌نویسی

Add Yoast SEO Breadcrumb to WordPress Theme

Breadcrumbs are a way to help your users better navigate your site and its structure. Additionally, they can appear on Google and provide a better user experience.

To make it easy for users and search engines to navigate your site, you need more than breadcrumbs. Yoast SEO Premium comes with an internal linking feature, as well as content filters. With those tools, you can keep your content structured, findable, and up-to-date.

The Yoast SEO breadcrumbs will output JSON-LD data in the source code. We have found this to be the most reliable method of implementing breadcrumbs for rich snippets.

So, how can we add this breadcrumb in our theme? The steps below are a temporary solution as manual edits made to theme files may be overwritten with future theme updates.

Copy the following code into your theme where you want the breadcrumbs to be.

NOTE: Depending on your theme you may or may not need to add in the beginning <php and ending ?> php tags.

Common places where you could place your breadcrumbs are inside your single.php and/or page.php file just above the page’s title. Moreover, another option that makes it really easy in some themes is by just pasting the code in header.php at the very end.

If you are using WordPress Twenty Twenty theme, and you want to have a breadcrumb like I used in this site, below the title of post, copy above code in themes/twentytwenty/template-parts/entry-header.php line ~46 and find the_title function, add the code after it. e.g. :

Hope you find it useful, if you cannot find the right place in your current theme and the developer cannot help you, feel free to ask for support at comment section.

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *