688 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 5 000 and 10 000 dollars
  • Uruguay
_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(){
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?


smoothwave_themes Recent Posts Threads Started
41 posts
  • Sold between 1 000 and 5 000 dollars
  • Exclusive Author
  • United Kingdom
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
  • Envato Studio (Microlancer) Beta Tester
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?