简体   繁体   中英

Hide breadcrumb in wordpress

I am using WooCommerce Breadcrumb Plugin and I want to hide it on specific page.I am doing it with the CSS like this :

.page-id-X  .woocommerce-breadcrumb{visibility:hidden;}

Is there any other way to hide it ? Because I don't to use that way as it make it static one.

Change PAGE_ID to the actual page ID, title or slug:

add_action( 'init', 'se26673973_remove_wc_breadcrumbs' );
function se26673973_remove_wc_breadcrumbs()
{
    if( ! is_page( PAGE_ID ) )
        return;

    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}

Edit page.php. Make an if statement with is_page to check if your specific page is viewed. Then drop your CSS property.


update - code:

in page.php place the following:

<?php 

// Check to see if the current used page is the specific one you're talking about
// Replace ID with your page ID
if (is_page(ID)){ 
?>
<style>
.page-id-X  .woocommerce-breadcrumb{visibility:hidden;}
</style>

<?php 
} // Closing the if curly braces 
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM