搜索

  • 好友链接

  • 链接表

  • Meta

    日志分类

    日志归档

    本月top点击

    历史top点击

    22

    关于本主题(Illacrimo Plus)的搜索问题

    终于把不搜索的问题解决了,不容易啊!

    下面开始说方法,一步一步来!

    第一步:

    这个主题下载的时候,好像本来就缺少一个search.php的文件,我也不知道是我下载的有问题,还是作者忘了放了!

    既然没有那我们自己建一个,文件名是search.php 放在主本主题的目录下面。内容我是根据别的主题的搜索和本主题的index.php改出来,下面放出来源代码

    search.php:

    <?php get_header(); ?>
    <!– Container –>
    <div id=”content”>

    <!– Start SC –>
    <div id=”SC”>

    <?php if (have_posts()) : $post_num = 0; ?>
    <?php while (have_posts()) : the_post(); $post_num++;?>

    <div class=”Post” id=”post-<?php the_ID(); ?>”>

    <div class=”PostHead”>
    <h1><a title=”Permanent Link to <?php the_title(); ?>” href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1>
    <small class=”PostAuthor”>Author: <?php the_author() ?> <?php edit_post_link(’Edit’); ?><?php if(function_exists(’the_ratings’)) { echo ” , Rating:”;the_ratings(’span’); } ?></small>
    <p class=”PostDate”>
    <small class=”day”><?php the_time(’j') ?></small>
    <small class=”month”><?php the_time(’M') ?></small>
    <small class=”year”><?php  the_time(’Y') ?></small>
    </p>
    </div>

    <div class=”PostContent”>

    <?php the_excerpt(’Read the rest of this entry &raquo;’); ?>

    </div>
    <div class=”PostDet”><ul>
    <li class=”PostCom”><?php comments_popup_link(’No Comments’, ‘1 Comment’, ‘% Comments’); ?><?php if(function_exists(’the_views’)) {$views=the_views(”,false); if ($views!=0)echo ” , “.$views.” Hits”; } ?></li>
    <li class=”PostCateg”><?php if(function_exists(’st_the_tags’))st_the_tags(); else the_category(’, ‘); ?></li></ul>
    </div>
    </div>

    <!–<?php trackback_rdf(); ?>–>
    <div class=”clearer”></div>
    <?php endwhile; ?>
    <div class=”navigation”>
    <div class=”alignright”><?php previous_posts_link(__(’Older Posts &raquo;’)) ?></div>
    <div class=”alignleft”><?php next_posts_link(__(’&laquo; Newer Posts’)) ?></div>
    </div>
    <br/>

    <?php else : ?>

    <h2 class=”center”><?php _e(’No posts found. Try a different search?’, ‘kubrick’); ?></h2>
    <?php include (TEMPLATEPATH . ‘/searchform.php’); ?>

    <?php endif; ?>

    </div>
    <!– End SC –>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    上面就是search.php的内容,把它上传到主题的目录下面,第一步结束了!

    上传完之后再去搜索发现还是出错,改来改去发现是url的问题。

    第二步,修改博客的固定链接

    进入wordpress管理后台,设置(Options)-永久链接(Permalinks),改成数字的那种形式就可以了!

    具体改永久链接的方法网上很多,这里就不多说了!

    上面两步做完了,就发现搜索问题解决了!

    有问题的话再单独问吧!

    相关日志

    2 条评论

    留下评论