Typecho Wiki
每一个作品都值得被记录

Typecho 创建独立搜索页面

Typecho维基君Typecho教程 • 5209次浏览 • 发布 2018-05-17 • 更新 2018-05-17
极致加速的V2Ray 助您畅享全球网络 & 搬瓦工VPS最新优惠码
🛜自用大流量超低月租手机卡推荐榜单 #拒绝流量焦虑

如何给 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

广告声明:文内含有的对外跳转链接(包括不限于超链接、二维码、口令等形式),用于传递更多信息,节省甄选时间,结果仅供参考,Typecho.Wiki所有文章均包含本声明。
本文检索关键词:typecho
厂商投放

【腾讯云】🎉五一云上盛惠!云服务器99元/月续费同价!

腾讯云五一劳动节海量产品 · 轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。快来腾讯云选购吧!

广告
添加新评论 »