PHP code example of it-for-free / wp-hierarchical-taxonomy-items-and-post-urls
1. Go to this page and download the library: Download it-for-free/wp-hierarchical-taxonomy-items-and-post-urls library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
it-for-free / wp-hierarchical-taxonomy-items-and-post-urls example snippets
use ItForFree\WpHiUrls\Breadcrumbs;
if (is_tax()) {
$Brkms = Breadcrumbs::getForTaxonomyItem();
} else {
$Brkms = Breadcrumbs::getForPost(get_post(), 'productscat');
}
$Brkms->addToStart(['/' => 'Главная', '/products' => 'Продукция']);
$Brkms->printHtml(
'<ul class="breadcrumb breadcrumb__t">',
'</ul>',
'<li>',
'</li>',
'<li class="divider"></li>',
true,
'<li class="active">',
'</li>'
);