2009-10-21 11:45
浏览 26


Got a weird bug best shown by this page

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>

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

Can a kind fellow offer any ideas? Thanks.

图片转代码服务由CSDN问答提供 功能建议


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


 &lt;?  php if(have_posts()):while(have_posts()):the_post();  ?&gt; 
&lt;?php $ externalLink = get_post_meta($ post-&gt; ID,'external link',true);  ?&gt; 
&lt;?php $ pdfLink = get_post_meta($ post-&gt; ID,'pdf link',true);  ?&gt; 
&lt; ul class =“article_index”&gt; 
&lt; li class =“title”&gt;&lt; a href =“&lt;?php the_permalink()?&gt;”  title =“Read&lt;?php the_title();?&gt;”&gt;&lt;?php the_title();  ?&gt;&lt; / a&gt;&lt; / li&gt; 
&lt; li class =“date”&gt;&lt;?php the_date('dmy')?&gt;&lt; / li&gt; 
&lt; li class  =“publication”&gt;&lt;?php echo get_post_meta($ post-&gt; ID,'publication',true)?&gt;&lt; / li&gt; 
&lt; li class =“tags”&gt;&lt;?php  the_tags('','','');  ?&gt;&lt; / li&gt; 
&lt; li class =“link”&gt;&lt;?php if(!$ externalLink){} else {?&gt;&lt; a href =“&lt;?php echo $ externalLink  ?&gt;“&gt;&lt; img src =”&lt;?php echo $ baseUrl;?&gt; images / icon_world.gif“alt =”Weblink“title =”Weblink“width =”16“height =”16“border  =“0”/&gt;&lt; / a&gt;&lt;?php}?&gt;&lt; / li&gt; 
&lt; li class =“pdf”&gt;&lt;?php if(!$ pdfLink){} else  {?&gt;&lt; a href =“&lt;?php echo $ pdfLink?&gt;”&gt;&lt; img src =“&lt;?php echo $ baseUrl;?&gt; images / icon_pdf.gif”alt =“查看 pdf“title =”查看pdf“height =”16“border =”0“/&gt;&lt; / a&gt;&lt;?php}?&gt;&lt; / li&gt; 
&lt; / ul&gt; 
&lt;  ?php endwhile;  ?&gt; 
&lt;?php endif;  ?&gt; 

善良的家伙可以提供任何想法吗? 谢谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duangongqiong6958 2009-10-21 12:07

    That's a documented "feature" of 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.
    打赏 评论
  • doufu1950 2011-04-10 06:01

    You may have found the answer by now but here is is: (works from version 3.0)

    <?php echo get_the_date('', $post->ID);?>
    打赏 评论

相关推荐 更多相似问题