• Resolved La M

    (@lady_moocher)


    Hi

    I have this latest news box on my home page. It’s meant to output the published date and excerpt text of the latest 3 posts with the news category.

    It’s working okay, but it only outputs the date of the first item in the list when news stories are published on the same date. How can I amend the code so that it always outputs the date?

    Thanks

    <h3>Latest news</h3>
    <div>

    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    <?php $postslist = get_posts(‘numberposts=3&order=DEC&orderby=date&cat=6’);
    foreach ($postslist as $post) :
    setup_postdata($post);
    ?>
    <img src=”<?php bloginfo(‘url’); ?>/articles/wp-content/images/arrow_white.gif” /> <?php the_date(); ?>: <?php the_title(); ?>
    <?php the_excerpt(); ?>

    <?php endforeach; ?>

    <?php endwhile; endif; ?>

    </div>
    </div>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php loop help needed – orderby’ is closed to new replies.