688 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 2
+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
  • Author Level 3
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
+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