This commit is contained in:
Sven Steinert
2026-05-13 11:57:52 +02:00
parent 6abf6f9c3d
commit f4511b9213
76 changed files with 4494 additions and 1940 deletions

View File

@@ -0,0 +1,26 @@
<?php
defined('ABSPATH') || exit;
?>
<section class="kb-search">
<h2><?php echo esc_html($title ?? __('Search Documentation', 'kb-markdown-importer')); ?></h2>
<form method="get" class="kb-search-form">
<input type="search" name="kbq" value="<?php echo esc_attr($query ?? ''); ?>" placeholder="<?php esc_attr_e('Search documentation', 'kb-markdown-importer'); ?>">
<button type="submit"><?php esc_html_e('Search', 'kb-markdown-importer'); ?></button>
</form>
<?php if (! empty($results)) : ?>
<ul class="kb-search-results">
<?php foreach ((array) $results as $result) : ?>
<?php
$product = get_post_meta($result->ID, '_kb_product_slug', true);
$version = get_post_meta($result->ID, '_kb_version_slug', true);
$page = get_post_meta($result->ID, '_kb_page_slug', true);
$url = \KbMarkdownImporter\Frontend\UrlBuilder::page((string) $product, (string) $version, (string) $page);
?>
<li>
<a href="<?php echo esc_url($url); ?>"><?php echo esc_html(get_the_title($result)); ?></a>
<p><?php echo esc_html(wp_trim_words(wp_strip_all_tags($result->post_content), 24)); ?></p>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</section>