• 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:

    https://www.rayah.org/rhemagarden/

    Here’s the code

    <div class="left">
    
    		<h2>Latest Posts</h2>
    
    		<ul class="block">
    
    <?php
    $myposts = get_posts('numberposts=5');
    
    if ($myposts) :
    
    	foreach ($myposts as $post) :
    
    		setup_postdata($post);
    
    		unset($categories);
    
    		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;?>
    			</ul>
    
    		</div>

    Any help appreciated ??
    Nicole

Viewing 3 replies - 1 through 3 (of 3 total)
  • probably because you are using the_date .. Might want to read that.

    Thread Starter nicolethompson11

    (@nicolethompson11)

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

    Try…

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