Support » Plugin: WooCommerce » quick php edit for breadcrumbs

  • Resolved travellers

    (@travellers)


    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?

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • you need to use the ! operator, which checks if something is NOT true

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

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

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

    It’s because wootique does

      weird

    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 🙁

    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;
    }
    add_filter(‘woo_breadcrumbs’,’crumb_filter’);

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

    @ bheadrick

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘quick php edit for breadcrumbs’ is closed to new replies.