initial COmmit: Add KB Antora Importer plugin files

This commit is contained in:
Sven Steinert
2026-05-12 14:37:09 +02:00
parent cf253c1367
commit 6abf6f9c3d
39 changed files with 2945 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
defined('ABSPATH') || exit;
?>
<section class="kb-search">
<h2><?php echo esc_html($title ?? __('Search Documentation', 'kb-antora-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-antora-importer'); ?>">
<button type="submit"><?php esc_html_e('Search', 'kb-antora-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 = \KbAntoraImporter\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>