永发信息网

wordpress 怎么调出最新的图文列表,标题+内容+图片

答案:3  悬赏:30  手机版
解决时间 2021-02-03 13:49
  • 提问者网友:战魂
  • 2021-02-02 23:27
wordpress 怎么调出最新的图文列表,标题+内容+图片
最佳答案
  • 五星知识达人网友:杯酒困英雄
  • 2021-02-02 23:35
我把我设计的主题的index.php文件代码贴出来吧,只能用于参考,你自己看着办吧,就是你要的效果。。
代码:<?php get_header(); ?>
<div class="post_list" id="left">
<?php $count = 0; ?>
<?php if (have_posts()) : ?>
<!-- POST LIST START -->
<?php while (have_posts()) : the_post(); ?>
<?php if($count == 2) : ?>
<div class="post_item">
</div>
<?php endif; ?>
<div class="post_item" id="post-<?php the_ID(); ?>">
<div class="post_pic">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail(array(200));
} ?>
</div>
<div class="post_title">
<!--这个是浏览数插件,如果没有,就去掉这代码,或者你自己安装个--><div class="post_views"><?php if(function_exists('the_views')) { the_views(); } ?></div>
<h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<span class="meta">
<?php echo get_avatar(get_the_author_email(), '15'); ?>
<?php the_author() ?> @ <?php the_category(', ') ?> <?php the_time('l') ?> <?php the_time('M j,Y') ?> <?php the_time('h:i A') ?> [<?php edit_post_link('Edit'); ?>]</span> </div>
<div class="post_desc">
<?php the_excerpt();?>
<p>TAGS:<?php the_tags(' ') ?><br />
COMMENTS:<?php comments_popup_link('0', '1', '%'); ?> 个童鞋留下<a href="<?php the_permalink() ?>#comment">脚印</a></p>
</div>
</div>
<?php $count++; ?>
<?php endwhile; ?>
<!-- POST LIST END -->
<!-- POST GAGEBAR START -->
<div class="pagenavigate">
<!--如果有导航插件,就放在这里-->
</div>
<!-- POST GAGEBAR END -->
<?php else : ?>

<h2><?php _e('Not Found'); ?></h2>

<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

<?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
</body>
</html>
全部回答
  • 1楼网友:躲不过心动
  • 2021-02-03 02:02
你好! 利用wordpress的缩略图实现,请首先开通缩略图功能,再设置自动生成缩略图,前台调用时检索有缩略图的文章按时间排序就可以了。 如果对你有帮助,望采纳。
  • 2楼网友:逐風
  • 2021-02-03 00:22
调到哪里 请说详细点
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯