各位老大,首页随机调用有缩略图的代码怎样写?不是推荐焦点图哦

chtws0012023-02-11  489

自己做的主页,希望主页每个栏目板块都可以显示带有缩略图的代码

有10万篇文章,有两百篇下载图片到本地服务器,怎样写随机调用多张缩略图的代码?

例如下列代码,有缩略图和没有图片的全部随机显示,怎么改动让它只显示含有缩略图的文章?

 

<?php $arrlist = thread_tid_find(1, 5000);
if ($arrlist) {
    $threads = count($arrlist);
    $total = $threads > 6 ? 6 : $threads;
    $tidarr = $threads > 6 ? array_rand($arrlist, $total) : array_keys($arrlist);
    $arrlist = well_thread_find_asc($tidarr, $total);
}
?>
<?php if($arrlist){ ?>

<?php foreach($arrlist as $_thread) { ?>

                      <div class="col-lg-6 col-12">
                      <div class="cms_grid_list">
                      <article class="post post-list type-post status-publish format-standard hentry category-pptmb">
                                                        
                            <div class="entry-media"><div class="placeholder" style="padding-bottom: 66.666666666667%"><a href="<?php echo $_thread['url'];?>" title="<?php echo $_thread['subject'];?>" rel="nofollow noopener noreferrer"><img class=" lazyloaded" data-src="<?php echo $_thread['icon_fmt'];?>" src="<?php echo $_thread['icon_fmt'];?>" alt="<?php echo $_thread['subject'];?>"></a></div></div>                            
                            <div class="entry-wrapper">
                              <header class="entry-header">
                                <h2 class="entry-title"><a href="<?php echo $_thread['url'];?>" title="<?php echo $_thread['subject'];?>" rel="bookmark"><?php echo $_thread['subject'];?></a></h2>                              </header>
                              <div class="entry-footer">
                                          <div class="entry-meta">
            
                          <span class="meta-date">
                  <time datetime="<?php echo date('Y-m-d', $_thread['create_date']);?>">
                    <i class="fa fa-clock-o"></i>
                    <?php echo date('Y-m-d', $_thread['create_date']);?>                  </time>
              </span>

          </div>
                                      </div>
                            </div>
                        </article>
                        </div>
                        </div>
                        <?php } ?>
      <?php } ?>

转载请注明原文地址:https://www.wellcms.net/read-605.html
00
最新回复(2)