42 lines
1.7 KiB
PHP
42 lines
1.7 KiB
PHP
<?php
|
|
|
|
$current_slug = get_post_field('post_name', get_post());
|
|
$pages = get_pages_as_array();
|
|
$pageForSlug = getPageForSlug($pages, $current_slug);
|
|
$parentPage = $pageForSlug->post_parent;
|
|
|
|
|
|
if ($parentPage === 0) {
|
|
$subpages = getSubpagesForSlug($pages, $current_slug);
|
|
} else $subpages = getSubpagesForSlug($pages, $pages[$parentPage]['page']->post_name);
|
|
|
|
|
|
if ($parentPage != 0 && count($subpages) > 0) { ?>
|
|
|
|
<div class="px-2 mt-4">
|
|
<ul role="list" class="max-w-7xl mx-auto text-blue-500 bg-white border-blue-500 border py-4 mb-4 rounded-md">
|
|
<li class="accordion">
|
|
<div class="flex px-2 rounded-md justify-between">
|
|
<div class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
|
|
<p>Quick Links</p>
|
|
</div>
|
|
<button class="accordion-toggle">
|
|
<i class="fas fa-chevron-down items-center ml-auto rounded-md bg-gray-900 px-2.5 py-2 text-white ring-1 ring-inset ring-gray-700" aria-hidden="true"></i>
|
|
<i class="fas fa-times items-center ml-auto rounded-md bg-gray-900 px-3 py-2 text-white ring-1 ring-inset ring-gray-700" aria-hidden="true"></i>
|
|
</button>
|
|
</div>
|
|
<ul class="accordion-content space-y-2">
|
|
<?php
|
|
foreach ($subpages as $subpage) { ?>
|
|
<li class="p-2">
|
|
<a href="<?php echo get_site_url() . '/' . $pages[$subpage->post_parent]['page']->post_name . '/' . $subpage->post_name ?>" class="flex space-x-2 items-center"><i class="bi-caret-right-fill"></i>
|
|
<p><?php echo $subpage->post_title ?></p>
|
|
</a>
|
|
</li>
|
|
<?php } ?>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<?php }
|