Created
April 4, 2022 19:36
-
-
Save ygnthetzaw/04a39790f9503e9d6ecc687c5ecb090b to your computer and use it in GitHub Desktop.
Revisions
-
ygnthetzaw created this gist
Apr 4, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ <?php global $wp; $route = home_url($wp->request); $routeArray = explode('/', $route); if (!empty($routeArray)) { $breadcrumb = '<ol class="breadcrumb">'; $link = ''; for ($i = 0; $i < count($routeArray); $i++) { $link .= $routeArray[$i] . '/'; if ($i >= 2) { if ($i == 2) { $breadcrumb .= '<li class="breadcrumb-item"><a href="' . $link . '">Home</a></li>'; } else { $breadcrumb .= '<li class="breadcrumb-item"><a href="' . $link . '">' . $routeArray[$i] . '</a></li>'; } } } $breadcrumb .= '</ol>'; } ?>