688 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

Hi, i´m developing a theme and for some reason i need to move the default position for breadcrubms (also for many other things) over woocommerce themes. Then i realised to do something like this on my functions.php:

function woocommerce_remove_breadcrumb(){
    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
add_action('woocommerce_before_main_content', 'woocommerce_remove_breadcrumb');

function woocommerce_custom_breadcrumb(){
    woocommerce_breadcrumb();
    }
add_action( 'woo_custom_breadcrumb', 'woocommerce_custom_breadcrumb' );

And then on any template file, output the breadcrumb just with:

<? do_action('woo_custom_breadcrumb'); ?>

And works. My question is more than that. Is this the correct approach for something like this? I mean for anything over woocommerce, not just breadcrumb, for any pice, ratings, titles, buttons, sidebar, and so on.

What i´m thinking on is why woocommerce templates don´t come with more deep code. I mean, why there´s no such a single-content-loop.php template where you can just change the order of things, title, category, content, images, etc. in an easy way rather that hooking into functions?

Thanks.

smoothwave_themes
smoothwave_themes Recent Posts Threads Started
41 posts
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
smoothwave_themes says

What you have there looks reasonable to me. Another method of doing what you need is via filters. Are there any filters you can hook into?

by
by
by
by
by
by