I am currently building my very first WordPress template (using Bootstrap 4) and I need to integrate breadcrumbs to my page. I can see that the theme we're currently using offers breadcrumbs as well, but as these are default breadcrumbs, it's by far not enough.
Default Breadcrumb, what I mean, is something simple as:
Home / Category / Subcategory / Page
What I need to build is more like:
Home / Category / Subcategory / Page as well, but when you hover Category oder Subcategory you should see the children of the currently selected option.
e.g. hovering HOME will display the available categories:
Home / Category / Subcategory / Page
|
Category A
Category B
Category C
Or, to see the other available subcategories, it will look like this:
Home / Category / Subcategory / Page
|
Subcategory A
Subcategory B
Subcategory C
I have already build this for a static page. Code looks like this:
<div class="d-none d-md-block">
<div class="dropdown">
<div class="dropdown-menu">
<a class="dropdown-item" href="~/Category1">Category 1</a>
<a class="dropdown-item" href="~/Category2">Category 2</a>
<a class="dropdown-item" href="~/Category3">Category 3</a>
</div>
<a class="dropdown-toggle" data-toggle="dropdown">
Home
</a>
</div>
<div class="dropdown">
<div class="dropdown-menu">
<a class="dropdown-item" href="~/Catgeory4/SubCat1">SubCat 1</a>
<a class="dropdown-item" href="~/Catgeory4/SubCat2">SubCat 2</a>
<a class="dropdown-item" href="~/Catgeory4/SubCat3">SubCat 3</a>
<a class="dropdown-item" href="~/Catgeory4/SubCat4">SubCat 4</a>
</div>
<a class="dropdown-toggle" data-toggle="dropdown">
Category 4
</a>
</div>
<a href="~/Catgeory4/SubCat2/Page" class="crumb active">Page</a>
</div>
The problem is, that it's my first ever WordPress template and that I only have a basic idea of the wordpress specific php at all :-[ So if you know a plugin that offers this kind of structure, I will be glad to use this. If I have to build it inside the template, fine with me as well.. I just don't know how to get startetd here, so that it results in a dynamic piece of code...
PS (if it does help at all): this is the current get_breadrumb function from the base theme:
if ( ! function_exists( 'bizbuzz_get_breadcrumb' ) ) {
/**
* Header image / Slider.
*
* @since 1.0.0
*/
function bizbuzz_get_breadcrumb() {
$enable_breadcrumb = bizbuzz_get_option( 'enable_breadcrumb' );
if ( $enable_breadcrumb ) {
$args = array(
'separator' => '>',
'show_current' => 1,
'show_on_home' => 0,
);
if ( is_home() || is_front_page() ) {
if ( $args['show_on_home'] ) {
?>
<div id="bizbuzz-breadcrumb">
<div class="rt-wrapper">
<?php bizbuzz_default_breadcrumb( $args ); ?>
</div>
</div>
<?php
}
} else {
?>
<div id="bizbuzz-breadcrumb">
<div class="rt-wrapper">
<?php bizbuzz_default_breadcrumb( $args ); ?>
</div>
</div>
<?php
}
}
}
}