Custom sorting for previous/next post links


/ Published in: PHP
Save to your folder(s)

Custom sorting for events based on a custom field
needs to be added to navigation-links.php
requires plugin: http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/


Copy this code and paste it in your HTML
  1. <?php elseif ( in_category('6') ) : ?>
  2.  
  3. <div class="navigation-links">
  4. <?php previous_post_link_plus( array(
  5. 'order_by' => 'custom',
  6. 'meta_key' => 'Datum',
  7. 'format' => '%link',
  8. 'link' => '&laquo; Vorige',
  9. 'before' => '<span class="previous">',
  10. 'after' => '</span>',
  11. 'in_same_cat' => true,
  12. ) );?>
  13. <?php next_post_link_plus( array(
  14. 'order_by' => 'custom',
  15. 'meta_key' => 'Datum',
  16. 'format' => '%link',
  17. 'link' => 'Nächste &raquo;',
  18. 'before' => '<span class="next">',
  19. 'after' => '</span>',
  20. 'in_same_cat' => true,
  21. ) );?>
  22. </div><!-- .navigation-links -->

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.