• Resolved chris15326

    (@chris15326)


    Hey! So I do want to hide the breadcrumbs on the productpage that I drive traffic to.

    I found this code that technically looks as if it should work:

    add_action('template_redirect', 'remove_page_breadcrumbs' );
    function remove_page_breadcrumbs(){
        if (is_page('YOUR_PAGE_ID_OR_SLUG'))
        remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }

    But somehow it changes nothing when I add a product page ID to test it. I can only assume that some of the WooCommerce classes are wrong?

    With kind regards
    Chris

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter chris15326

    (@chris15326)

    Okay I was able to do this with CSS, after I needed to try a lot of different ways to format the page-id. Because I only wanted to hide the breadcrumbs on the product page where I’m running ads to.

    I don’t know if the PHP version would have any advantages, but I can’t make it work through the PHP.

    Here is the CSS solution:

    .postid-694 .woocommerce-breadcrumb {
      display: none !important;
    }
    
    .postid-694 .archive-header {
       padding-top: 15px !important;
    }
    • This reply was modified 2 years ago by chris15326.
    Igor H

    (@ihereira)

    Hello,

    want to hide the breadcrumbs on the productpage that I drive

    May I ask if you replace is_page() with is_product() does it work as you need?

    Thread Starter chris15326

    (@chris15326)

    Hey! As I said above for me the solution was this:

    .postid-694 .woocommerce-breadcrumb {
      display: none !important;
    }
    
    .postid-694 .archive-header {
       padding-top: 15px !important;
    }

    ??

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