此页面最佳显示了一个奇怪的错误 http://www.zoecormier.com/freelance/

向下滚动到名为“测试turnitin”的文章,您将看到文章日期未显示。它上面的文章(名为“被盗词”)显示日期。这两篇文章的日期相同,但只有一篇正在显示它。

文章列表的代码是:

<?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; ?>

一位善良的人可以提供任何想法吗? 感谢。

有帮助吗?

解决方案

这是一个记录在案的“功能”。 of_date()

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

特别注意:当在同一天发布的页面上有多个帖子时,the_date()仅显示第一个帖子的日期(即the_date()的第一个实例)。要重复在同一天发布的帖子的日期,您应该使用模板标记the_time()和日期特定的格式字符串。

其他提示

您现在可能已找到答案,但现在是: (适用于3.0版本)

<?php echo get_the_date('', $post->ID);?>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top