hesabixWpTheme/wedocs/docs-sidebar.php
2026-05-22 13:52:15 +03:30

58 lines
2.6 KiB
PHP

<?php
/**
* سایدبار ناوبری داکیومنت — تم Hesabix2
*/
$ancestors = [];
$root = $parent = false;
if ( ! empty( $post->post_parent ) ) {
$ancestors = get_post_ancestors( $post->ID );
$root = count( $ancestors ) - 1;
$parent = $ancestors[ $root ];
} else {
$parent = ! empty( $post->ID ) ? $post->ID : '';
}
$walker = new WeDevs\WeDocs\Walker();
$children = wp_list_pages( [
'title_li' => '',
'order' => 'menu_order',
'child_of' => $parent,
'echo' => false,
'post_type' => 'docs',
'walker' => $walker,
] );
?>
<aside class="wedocs-sidebar wedocs-hide-mobile flex-shrink-0 bg-slate-50 lg:w-72 p-6 lg:py-8 overflow-y-auto" dir="rtl">
<h3 class="wedocs-sidebar-title text-base font-bold text-slate-800 mb-4 pb-3 border-b border-slate-200">
<?php echo esc_html( get_post_field( 'post_title', $parent, 'display' ) ); ?>
</h3>
<div class="wedocs-single-search-input mb-6">
<div class="relative">
<input
name="s"
readonly
type="search"
class="search-field w-full pr-10 pl-4 py-3 rounded-xl border border-slate-200 bg-white text-slate-700 placeholder-slate-400 focus:ring-2 focus:ring-brand-500 focus:border-brand-500 transition-all text-sm text-right"
value="<?php echo esc_attr( get_search_query() ); ?>"
title="<?php echo esc_attr_x( 'Search for:', 'label', 'wedocs' ); ?>"
placeholder="<?php echo esc_attr_x( 'جستجو در راهنما...', 'placeholder', 'wedocs' ); ?>"
/>
<span class="absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
</span>
</div>
<button type="button" class="search-submit absolute left-3 top-1/2 -translate-y-1/2 w-9 h-9 rounded-lg bg-brand-500 text-white flex items-center justify-center opacity-0 pointer-events-none" aria-hidden="true"></button>
<div class="short-key mt-2 text-xs text-slate-400">Ctrl/⌘ + K</div>
</div>
<?php if ( $children ) { ?>
<nav class="wedocs-doc-nav" aria-label="<?php esc_attr_e( 'فهرست راهنما', 'wedocs' ); ?>">
<ul class="doc-nav-list wedocs-tree space-y-0.5 text-sm">
<?php echo $children; ?>
</ul>
</nav>
<?php } ?>
</aside>