WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. travellers
    Member
    Posted 1 year 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?

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

  2. helgatheviking
    Member
    Posted 1 year ago #

    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 } ?>
  3. travellers
    Member
    Posted 1 year ago #

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

  4. travellers
    Member
    Posted 1 year ago #

    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 :(

  5. bheadrick
    Member
    Posted 1 year 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;
    }
    add_filter('woo_breadcrumbs','crumb_filter');

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

  6. travellers
    Member
    Posted 1 year 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

About this Topic