douju1997 2009-10-21 11:45
浏览 26
已采纳

Wordpress:如果两个或多个帖子具有相同的日期,则不显示日期

Got a weird bug best shown by this page http://www.zoecormier.com/freelance/

Scroll down to the article named 'Testing turnitin' and you will see the article date is not showing. The article above it (named 'Stolen words') is showing the date. These two articles have the same date, but only one is displaying it.

Code for the article list is:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php $externalLink = get_post_meta($post->ID, 'external link', true); ?>
<?php $pdfLink = get_post_meta($post->ID, 'pdf link', true); ?>

<ul class="article_index">
    <li class="title"><a href="<?php the_permalink() ?>" title="Read <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <li class="date"><?php the_date('d.m.y') ?></li>
    <li class="publication"><?php echo get_post_meta($post->ID, 'publication', true) ?></li>
    <li class="tags"><?php the_tags(' ',' ',' '); ?></li>
    <li class="link"><?php if ( !$externalLink ) { } else { ?><a href="<?php echo $externalLink ?>"><img src="<?php echo $baseUrl; ?>images/icon_world.gif" alt="Weblink" title="Weblink" width="16" height="16" border="0" /></a><?php } ?></li>
    <li class="pdf"><?php if ( !$pdfLink ) { } else { ?><a href="<?php echo $pdfLink ?>"><img src="<?php echo $baseUrl; ?>images/icon_pdf.gif" alt="View pdf" title="View pdf" height="16" border="0" /></a><?php } ?></li>
</ul>

<?php endwhile; ?>
<?php endif; ?>

Can a kind fellow offer any ideas? Thanks.

  • 写回答

2条回答 默认 最新

  • duangongqiong6958 2009-10-21 12:07
    关注

    That's a documented "feature" of the_date()

    http://codex.wordpress.org/Template_Tags/the_date:

    SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() with a date-specific format string.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示