WooCommerce - excelling eCommerce
[resolved] quick php edit for breadcrumbs (6 posts)

  1. travellers
    Posted 2 years ago #

    At the top of page.php in Wootique, there is:

    <?php if ( $woo_options[ 'woo_breadcrumbs_show' ] == 'true' ) { ?>
    		<?php woo_breadcrumbs(); ?>
    	<?php } ?>

    and I'm trying to wrap that in

    <?php if (is_home()) {
    	echo '';
    } else

    so that breadcrumbs only show up on pages other than the homepage. I'm doing something wrong though, because it keeps breaking! Can someone tell me the correct formatting for this please?


  2. helgatheviking
    Posted 2 years ago #

    you need to use the ! operator, which checks if something is NOT true

     if ( $woo_options[ 'woo_breadcrumbs_show' ] == 'true' && ! is_home() ) { ?>
    		<?php woo_breadcrumbs(); ?>
    	<?php } ?>
  3. travellers
    Posted 2 years ago #

    I thought that looked right, but when I tried it just now I still have breadcrumbs on my homepage :(

  4. travellers
    Posted 2 years ago #

    I've found out WHY your code doesn't work, but not how to solve it!

    It's because wootique does

    things when building pages, I mean REALLY weird. My 'Home' page isn't constructed using page.php (but I haven't the faintest idea what it IS constructed using), and I've completely proved that by - in utter frustration - deleting page.php entirely from the server, and Home still shows up when refreshed (obviously no other page does).

    The only possible thing I can think of is that I did import this whole site from a test site I had elsewhere, which was using a different theme, but I can't figure out how that might cause issues like this. I've also found out that /shop/ isn't defined using page.php either, as per this post
    here, but again can't figure where it IS defined. Something is proper wrong here :(

  5. bheadrick
    Posted 2 years ago #

    good news! There's an applied filter in the woo_breadcrumbs function, so you could add this to your functions.php:

    function crumb_filter($crumbs){
    if(is_home() || is_front_page()){
    $crumbs = '';
    return $crumbs;

    this way, you don't have to mess with any page templates.

  6. travellers
    Posted 2 years ago #

    @ bheadrick

    That little snippet works a treat, many thanks! I'm marking this as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic