Search code examples
drupaldrupal-7drupal-theming

Previous/next navigation that uses ordering/sorting different than node id (n.nid)


I am trying to create "previous/next node" navigation on my nodes in order to show 2 previous and 2 following nodes in the term currently being viewed. Here is the code that displays 2 prev and 2 next nodes, but it is not taxonomy aware, i. e. it sorts nodes according to their IDs:

Prev/Next node navigation with a thumbnail in a full node

If I add a node in the term after some time, it will display this node as the last one, not as a "neighbour" of a node uploaded e.g. 3 months ago.

I have tried with "n.title", but it doesn't change anything. Ideally, it should order them either by titles or url aliases.

Thank you in advance!


Solution

  • Newer version of Previous/Next module has multiple options for sorting prev/next nodes. You can use the workaround to get thumbnails too:

    http://drupal.org/project/prev_next http://drupal.org/node/1790290