Skip Navigation

[Resolved] show breadcrumbs at search results

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1852475

If I simply put the shortcode at results template, I get same breadcrumbs at each results (home -> search)

<h3>[wpv-post-link]</h3>
[yoast-breadcrumbs]
[wpv-post-excerpt]

How can I reset them to get breadcrumbs per post?

#1852721

As far as I know, the yoast-breadcrumbs shortcode isn't designed to be used in a listing of posts, it's designed to display information about the post or archive being displayed (i.e. breadcrumbs relative to the current URL). However, I'm not a Yoast expert so I'm not the best source of information about that. If you need to display breadcrumb information about each post in a View's loop, I suggest reaching out to the Yoast support team to see if their yoast-breadcrumbs shortcode allows you to add a specific post ID as a shortcode attribute. If so, you could pass in the current post's ID using the wpv-post-id shortcode from Views, something like this:

[yoast-breadcrumbs post-id="[wpv-post-id]"]

Again, that would only work if the yoast-breadcrumb shortcode accepts some shortcode argument for a specific post ID. I'm not sure about that, I can't find any documentation about the shortcode's accepted attributes in a quick search.

If the shortcode does not provide the ability to supply an explicit post ID attribute, or they do not have a separate shortcode for some specific post ID's breadcrumbs, it will most likely require custom code. I found some information about their Surfaces API, which can be used to query the breadcrumbs of a specific post: https://developer.yoast.com/customization/apis/surfaces-api
This Stack Overflow article describe other custom solutions for including breadcrumbs in search results:
https://stackoverflow.com/questions/26302801/wordpress-breadcrumbs-in-search-results
In either case, I recommend reaching out to Yoast support for more information as this code is outside the realm of Toolset.