show breadcrumbs on shop pages only

#366170
  • Resolved Red Pill Design
    Rank Math free

    Hi,

    I am developing a website for a customer with a WooCommerce webshop using the Hadleigh theme by Pix & Hue.
    The client would like to display breadcrumbs, but only on the shop related pages, such as:

      the shop page
      the product category overviews
      the single product pages
      etc…

    Is there a simple way to accomplish this or should I just add the [rank_math_breadcrumb] shortcode on all of the aforementioned pages.

    With regards,
    Hasso Weeke
    RED PILL Design

Viewing 9 replies - 1 through 9 (of 9 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support.

    If there are only a few pages where the breadcrumbs are to be applied, then the easiest approach is to use the shortcode.

    Alternatively, you can edit the breadcrumbs code and add a condition that allows the addition of breadcrumbs only on the required pages:
    <?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?>

    Hope this helps.

    Thank you.

    Hello Prabhat,

    Thank you for the reply.
    The shop has quite a number of products and this will only increase over time.
    How would I need to change the breadcrumb code so they only show on the WooCommerce pages and it also applies to new products.

    With regards
    Hasso

    Hello,

    You can use the code given below in a template file of your theme to apply the breadcrumbs to your shop and all of your products:

    if (function_exists('rank_math_the_breadcrumbs') && is_woocommerce()) rank_math_the_breadcrumbs();
    

    Hope this helps. Let us know if you need any other assistance.

    Thanks.

    Hello Jaideep,

    Thank you for the reply.
    The site uses a child theme. Could you advise in which template file of the theme the code should be added?

    With regards,
    Hasso

    Hello,

    You can insert the code to your theme child’s functions.php file. If your child theme doesn’t have this file, you can create it via your FTP. Just ensure to enclose the code my colleague provided with <?php ... ?> tags.

    Let us know how that goes. Looking forward to helping you on this one.

    Hi Jeremy,

    I added the code to the functions.php in the child theme, but no breadcrumbs are displayed.

    With regards,
    Hasso

    Hello,

    I have created a header.php file in your child theme and added the code inside it. Now the breadcrumbs are visible on your Shop & Product pages.

    Please check and let us know if you need any other assistance.

    Thanks.

    Hi Jaideep,

    You’re Awesome!!!

    Thanks a million.

    Hasso

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The ticket ‘show breadcrumbs on shop pages only’ is closed to new replies.