• Resolved yakiimo

    (@albertof92)


    Hello,

    Is it possible to set to show the breadcrumbs only on a specific page (or set of pages) of the website?
    In my specific case, I would like to visualize them only on the shop page and all the pages under that (category pages, product pages etc.)
    I think there’s the option to exclude specific pages by ID but I would like to do a kind-of inverse procedure, otherwise it would take a lot of time.

    Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author John Havlik

    (@mtekk)

    Yes it is possible, but how it is accomplished depends on how you are calling the breadcrumb trail. For must users, that are using the bcn_display() function, if it is located in a file that is used in all theme files (e.g. something like in your theme’s header.php), then you can surround the call with a check for the appropriate conditional check.

    <?php if(function_exists('bcn_display') && (is_singular('foo') || is_tax('flavor'))):?>
    <div class="breadcrumbs" typeof="BreadcrumbList" vocab="https://schema.org/">
    <?php bcn_display();?>
    </div>
    <?php endif; ?>

    Where foo is the post type you care about and flavor is the taxonomy you care about. You can chain additional conditional tags by ORing them to the existing conditional check.

    Thread Starter yakiimo

    (@albertof92)

    Thank you very much! I solved using is_woocommerce() as conditional! ??

    • This reply was modified 4 years, 4 months ago by yakiimo.
    • This reply was modified 4 years, 4 months ago by yakiimo.
    cyriellecv

    (@cyriellecv)

    @albertof92 Trying to do the same thing. Would you be able to share the entire code line you used and where did you add it in your header.php please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show breadcrumbs only on specific page’ is closed to new replies.