Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questioni was just struggle for hours now trying to deal with the breadcrumb of woocommerce, I just saw that with a normal function it doesnt work..
add_filter( 'woocommerce_breadcrumb_defaults', 'custom_breadcrumb');
function custom_breadcrumb() {
return array(
'delimiter' => '<li class="mx-2 text-gray-500">/</li>',
'wrap_before' => '<ol class="breadcrumb flex text-xs uppercase text-gray-400 font-medium">',
'wrap_after' => '</ol>',
'before' => '<li class="hover:text-blue-500">',
'after' => '</li>',
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
);
}
but the closure one bellow works
add_filter( 'woocommerce_breadcrumb_defaults', function() {
return array(
'delimiter' => '<li class="mx-2 text-gray-500">/</li>',
'wrap_before' => '<ol class="breadcrumb flex text-xs uppercase text-gray-400 font-medium">',
'wrap_after' => '</ol>',
'before' => '<li class="hover:text-blue-500">',
'after' => '</li>',
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
);
} );
Anyone can explain why it doesnt work or where i failed?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questioni was just struggle for hours now trying to deal with the breadcrumb of woocommerce, I just saw that with a normal function it doesnt work..
add_filter( 'woocommerce_breadcrumb_defaults', 'custom_breadcrumb');
function custom_breadcrumb() {
return array(
'delimiter' => '<li class="mx-2 text-gray-500">/</li>',
'wrap_before' => '<ol class="breadcrumb flex text-xs uppercase text-gray-400 font-medium">',
'wrap_after' => '</ol>',
'before' => '<li class="hover:text-blue-500">',
'after' => '</li>',
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
);
}
but the closure one bellow works
add_filter( 'woocommerce_breadcrumb_defaults', function() {
return array(
'delimiter' => '<li class="mx-2 text-gray-500">/</li>',
'wrap_before' => '<ol class="breadcrumb flex text-xs uppercase text-gray-400 font-medium">',
'wrap_after' => '</ol>',
'before' => '<li class="hover:text-blue-500">',
'after' => '</li>',
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
);
} );
Anyone can explain why it doesnt work or where i failed?
Share Improve this question asked Feb 13, 2020 at 19:42 Jonathan V.Jonathan V. 11 bronze badge 1 |1 Answer
Reset to default 0My bad.. it was the namespace
add_filter( 'woocommerce_breadcrumb_defaults', 'mynamespace\\custom_breadcrumb');
custom_breadcrumb()
somewhere on your site. Try changing it to something more unique, to see if that helps. – Jacob Peattie Commented Feb 14, 2020 at 16:08