-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
33 lines (28 loc) · 1.04 KB
/
example.php
File metadata and controls
33 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once 'LevDBreadcrumbsData.php';
function show_custom_breadcrumbs($args = [])
{
$crumbs_data = new LevDBreadcrumbsData();
$crumbs = $crumbs_data->build($args);
if ( ! empty($crumbs) ) {
echo '<ul itemscope itemtype="https://schema.org/BreadcrumbList">';
foreach ($crumbs as $i => $crumb) {
if ( empty($crumb['url']) ) {
echo '<li>';
echo '<span class="current">';
echo '<span>' . $crumb['title'] . '</span>';
echo '</span>';
echo '</li>';
} else {
echo '<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">';
echo '<a itemprop="item" href="' . $crumb['url'] . '">';
echo '<span itemprop="name">' . $crumb['title'] . '</span>';
echo '</a>';
echo '<meta itemprop="position" content="' . ($i+1) . '" />';
echo '</li>';
}
}
echo '</ul>';
}
}
show_custom_breadcrumbs();