关于本站的“文章检索”页面

2007-09-10 – 10:54 上午 --- 4,564 次阅读

一直想做一个实时预览文章的东西,却不知道做在哪好。现在终于完成了,请看本站的“文章检索”页面。

舍弃了华丽但是臃肿的af-extended-live-archive,换用了Viper007Bond同学的Clean Archives Reloaded,特别欣赏作者对JS代码随用随载的方法,而不是一股脑全往Header里面丢。

看到文章列表后面那个小图标了吗?点它!---这就是我加的一点小佐料:文章实时预览。

参考ajaxwp,改变思路,用WordPress原本的方式渲染文章,用脚本访问 ajax-wp.php:


<?php
/**
 * AjaxWp - An AJAX enchancement for Wordpress
 * Copyright (c) 2006, Gianni Milanesi <gianni@giannim.com>
 *
 * AjaxWp is freely distributable under the terms of an MIT-style license.
 * For details, see the AjaxWp web site: http://www.giannim.com/projects/ajax-wp
 *
 */
	$postid = $_GET['postid'];
	require('../../../wp-blog-header.php');
	// Load the requested posts
	query_posts('p='.$postid);
	include("ajax-single.php");
?>

其中ajax-single.php则为原模板single.php去掉头尾等多余内容而来:


<div id="content">
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="entry">
		<div class="post" id="post-<?php the_ID(); ?>">
			<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title('-image-'); ?></a></h2>
			<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
			<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?><br />
	<?php endwhile; else: ?>
		<div class="entry">
			<p>Sorry, no posts matched your criteria.</p>
		</div>
    <?php endif; ?>
</div>

我希望能得到一些意见建议,如果把这东西处理好了,做成插件应该是蛮好的。

点击显示引用框
引用本文,复制粘贴...

点击可把本文加入多个网络分享站点

上下文导读:

前一页: Quake OST CollectionGrass.Valley.ProCoder.v3.00.50 :下一页

您还可以参考以下文章:


标签相关

  1. 6 个评论 “关于本站的“文章检索”页面”

  2. 挺不错,载入时最好有个转啊转的东西,那个文字不明显。
    文章列表的方式也最好能有分类或者Tag。

    By hhalloyy on Sep 10, 2007

  3. 列表内容是Clear Archives自己带的,我没改动;加分类可能不难,Tag的话我用的Simple Tagging,还没去细研究。。

    提示我找时间改掉,谢谢。

    By AvP on Sep 10, 2007

  4. 一直用Clean Archive,这个的想法更好呀,可惜还没有完全解决预览的排版问题。参照excerpt的预览会有问题吗(我都没用excerpt的,所以不知道效果如何)?

    By Calon on Sep 10, 2007

  5. excerpt基本就是把Tag全去掉了,整版一大片那种。。。

    By AvP on Sep 11, 2007

  6. 我发现,主要是我发文太乱...要是换了别人的文章,估计很好处理,特别是没图片那种大片文字的...

    By AvP on Sep 11, 2007

  7. 更新了一下截取函数,感觉差不多了。

    By AvP on Sep 23, 2007

您必须 登录 才能发表评论.