-
AuthorPosts
-
August 7, 2024 at 8:01 pm #1464052
Hello. When on the single product pages, is there a way to make the breadcrumb only show up to the last category, and not display the individual (single) product page titles? Thanks.
August 8, 2024 at 4:54 am #1464096Hey Illingco,
Thank you for the inquiry.
Please try to add this filter in the functions.php file:
function avia_breadcrumbs_trail_mod($trail) { if (is_singular('product')) { unset($trail['trail_end']); } return $trail; } add_filter('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 1);
Best regards,
IsmaelAugust 8, 2024 at 7:24 pm #1464164Thank you for this! Is there any way to remove the category or product title of the page the user is on? Otherwise this will do. Also, what might the CSS be to change color as a user hovers on each part of the breadcrumb? Thanks for all the support!
August 9, 2024 at 4:36 am #1464199Hi,
Thank you for the update.
If you want to remove the category trail, just add this code:
unset($trail[3]);
.. under this line:
unset($trail['trail_end']);
And to change the color of the breadcrumb trail on hover, add this css code:
.breadcrumb-trail :hover { color: blue !important; }
Best regards,
IsmaelAugust 9, 2024 at 3:58 pm #1464267Thanks for this. But I meant do not show the category that the user is on no matter what page they are on, be it category page or single product page. Like if I am on the page for Plastic Round Open Head Pails as linked, the breadcrumb would be Home / Shop / Pails & Buckets without Plastic Round Open Head Buckets as the last part of the string, since the user is already on that page. But I would like the full string on single product pages but without the product title on those pages. If both are not possible please let me know. Thanks.
August 10, 2024 at 6:37 pm #1464337Hi,
When I test this does what you ask on my test site:function avia_breadcrumbs_trail_mod($trail) { if (is_singular('product') || is_archive()) { unset($trail['trail_end']); unset($trail[3]); unset($trail[2]); } return $trail; } add_filter('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 1);
Best regards,
MikeAugust 12, 2024 at 4:18 pm #1464461Hi Mike. I don’t see that it does work. That code takes it down to Home / Shop, and that is it. I’m just looking to ideally truncate the category page if a user is on it, but have it back on single product pages, but not the title of that page. However, this seems to work as asked for:
function avia_breadcrumbs_trail_mod($trail) {
if (is_singular(‘product’) || is_archive()) {
unset($trail[‘trail_end’]);
}return $trail;
}
add_filter(‘avia_breadcrumbs_trail’, ‘avia_breadcrumbs_trail_mod’, 50, 1);- This reply was modified 3 months, 1 week ago by Illingco.
August 13, 2024 at 5:34 am #1464501Hi,
Is there any way to remove the category or product title of the page the user is on?
Previously, you asked if it was possible to remove or hide the category. The snippet we suggested earlier should remove both the category and the post title.
Best regards,
IsmaelAugust 13, 2024 at 3:18 pm #1464536I found the correct combination of code, thank you. You may close this ticket.
August 13, 2024 at 10:50 pm #1464565Hi,
Thanks for the update, we’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Breadcrumb not to display single product titles?’ is closed to new replies.