Typecho 创建独立搜索页面

如何给 Typecho 主题添加独立搜索页面,可以使用下面代码:

<?php
/**
* Template Page of Search
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('header.php');
?>

<div class="main-content page-page">
    <div class="search-page">
        <form id="search" class="search-form" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
            <span class="search-box clearfix">
                <input type="text" id="input" class="input" name="s" required="true" placeholder="Search..." maxlength="30" autocomplete="off">
                <button type="submit" class="spsubmit"><i class="icon-search"></i></button>
            </span>
        </form>
        <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=count&ignoreZeroCount=1&desc=1&limit=50')->to($tags); ?>
        <div class="search-tags">
        <?php $this->content(); ?>
        <?php if($tags->have()): ?>
            <?php while ($tags->next()): ?>
            <a href="<?php $tags->permalink(); ?>" class=""># <?php $tags->name(); ?>(<?php $tags->count(); ?>)</a>
            <?php endwhile; ?>
        <?php else: ?>
            <p> Nothing here ! </p>
        <?php endif; ?>
        <div class="search-tags-hr"></div>
        </div>
    </div>
</div>

<?php $this->need('footer.php'); ?>

以上代码提取自 Typecho 简约卡片主题 Pinghsu

Updated: 17/05/2018 — 17:34

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注