Thread Starter
ab2211
(@ab2211)
Ok, I found a shortcode to do this: [oceanwp_breadcrumb]
Glad to hear that you found it.
Thread Starter
ab2211
(@ab2211)
Disadvantage: I need to paste this snippet in every single page.
No need to add shortcode each time. Add the below code to the child theme’s functions.php file to add the breadcrumb above the title –
function prefix_oceanwp_breadcrumb() {
echo do_shortcode( '[oceanwp_breadcrumb]' );
}
add_action('ocean_before_content_inner','prefix_oceanwp_breadcrumb');
Thread Starter
ab2211
(@ab2211)
Ok, thanks, interesting. But, what if I want the breadcrumbs just on some pages?
You can add a condition in the code like the below code –
function prefix_oceanwp_breadcrumb() {
if (is_page( array( 42, 54, 6 ) ) ) {
echo do_shortcode( '[oceanwp_breadcrumb]' );
}
}
add_action('ocean_before_content_inner','prefix_oceanwp_breadcrumb');
See all conditional tags – https://codex.wordpress.org/Conditional_Tags