0

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?

0

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();
  • 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? – gmazzap Aug 21 '13 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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