Support » Themes and Templates » Inconsistent Code

  • Hi Again,

    I cannot figure out why the date is only showing on the first (most recent) post in my “Latest Posts” list at the foot of the page:

    Here’s the code

    <div class="left">
    		<h2>Latest Posts</h2>
    		<ul class="block">
    $myposts = get_posts('numberposts=5');
    if ($myposts) :
    	foreach ($myposts as $post) :
    		foreach (get_the_category() as $category)
    			$categories[] = $category->cat_name;?>
    <li><a href="<?php the_permalink();?>">
    <span><?php the_title(); ?></span>
    <em><?php the_date();?></em></a></li>
    <?php endforeach;?>
    <?php else : ?>
    				<li>no entries</li>
    <?php endif;?>

    Any help appreciated 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • whooami



    probably because you are using the_date .. Might want to read that.

    OK…. sorry, but that doesn’t help me much, what exactly is wrong with my code? how can I fix it?


    <?php the_time(‘F j, Y’); ?>

    instead. whooami’s link says it all in each of the first 3 sentences. All will become clear to those who follow the link.

    The above should display something like May 5, 2008.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Inconsistent Code’ is closed to new replies.