WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Two get_post no date on 2nd

[Resolved] Two get_post no date on 2nd

  • Hi!

    I’m having a little problem with get_post

    I have two get_post on my index and the second one dosen’t display the date. Only the first query. Although it shows the permlink on the second one.

    Heres my code:

    <div id="posts">
            <div id="latest-news">
                <div class="media-top"></div>
                <div class="media-bg">
                    <h2>Latest news</h2>
    
          <?php
     $lastposts = get_posts('numberposts=5&category=1&order=ASC&orderby=date');
     foreach($lastposts as $post) :
        setup_postdata($post);
     ?>
    
       <p class="date"><?php the_date(); ?></p>
      <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
    
     <?php endforeach; ?>
                    <br/><br/>
                    <a href="/news" class="highlight">View all news</a>
    
                </div>
                <div class="media-end"></div>
            </div>     <!-- END #LATEST-NEWS -->
    
            <div class="hspaceFix"></div>
    
            <div id="latest-media">
                <div class="media-top"></div>
                <div class="media-bg">
                    <h2>Latest media</h2>
    
                      <?php
     $mediaposts = get_posts('numberposts=5&category=-1&order=ASC&orderby=date');
     foreach($mediaposts as $post) :
        setup_postdata($post);
     ?>
    
       <p class="date"><?php the_date(); ?></p>
      <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
    
     <?php endforeach; ?>
    
                    <br/><br/>
                    <a href="/media" class="highlight">View all media posts</a>
    
                </div>
                <div class="media-end"></div>
    
            </div>   <!-- END #LATESTMEDIA-MEDIA -->
        </div>

    Any ideas why it isen’t working?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Two get_post no date on 2nd’ is closed to new replies.