Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking for something to create a multi footer with previous / next posts. The footer needs to know if the current post is the newest (1st, 2nd and 3rd newest), oldest (3rd, 2nd, and oldest) or in between.

As an example: enter image description here

The old / new links include title & thumbnail.

Does anyone know how I can achieve this?

share|improve this question
add comment

1 Answer

Maybe I don't understand the question, sorry in that case.

But can't you just retrieve the last 6 posts excluding the current? Something like:

global $post;

$footer_posts = wp_get_recent_posts( array('post_status' => 'publish', 'posts_per_page' => '6', 'exclude' => $post->ID), 1 );

if ( ! empty($footer_posts) ) { foreach ( $footer_posts as $post ) {
  setup_postdata($post);
  echo '<div style="float:left; margin-left:20px;">';
  echo '<a href="' . get_permalink() . '">';
  the_post_thumbnail('thumb');
  echo '<br /><h4 style="text-align:center;">' . get_the_title() . '</h4></a>';
  echo '</div>';
} }

wp_reset_postdata();
share|improve this answer
    
Hey G.M. thanks for your comments but what don't you understand of the question? Then I can edit it.. I tried your solution but it seems not to work. –  rwzdoorn Aug 21 '13 at 14:31
    
there was an error in code. I've edited the code adding som html decorations. Note that this works on single post view. For me works perfectly, what exactly doesn't work for you? –  G. M. Aug 21 '13 at 15:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.