wordpress 调用分类列表 不同的列表样式


我们在WordPress CMS网站中常常看到同一分类调用不同的文章样式,前面几篇和后面的文章显示不同的样式

通过以下代码即可实现这个功能:

12345678910111213<?php query_posts("showposts=2&cat=1"); ?><?php while (have_posts()) : the_post(); ?><div > <a href="<?php%20the_permalink()%20?>"><img src='<?php echo catch_first_image() ?>' border='0' width='120' height='90' alt='<?php the_title_attribute(); ?>'></a><h4><a href="<?php%20the_permalink()%20?>"target="_blank"><?php the_title_attribute(); ?></a></h4><p><?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 80,"..."); ?></p> </div><?php endwhile; ?><ul ><?php query_posts("showposts=3&cat=1&offset=2"); ?><?php while (have_posts()) : the_post(); ?><li><span > <a href="<?php%20the_permalink()%20?>" targent="_blank" ><?php the_title_attribute(); ?></a> </span></li><?php endwhile; ?>

以上代码是调用分类id为1的列表

前面两篇文章是上面图片展示的样式,之后的文章以列表的形式显示!


上一篇:wordpress分类列表调用该分类置顶文章

下一篇:wordpress文章形式添加及改名


Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器