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 trying to get a navigation in the events of event manager

the next/previous post links work but they are ordered by creation date instead of event date.

How could it be possible to change this?

share|improve this question

1 Answer 1

The function WordPress ultimately uses for this is get_adjacent_post(), which has filters that allow you to modify the query directly. You'd have to modify the JOIN, WHERE and ORDER BY clauses to join the post meta table and order by your custom field.

Another option is the Ambrosite Next/Previous Post Link Plus plugin.

share|improve this answer
    
To use get_adjacent_post, you would basically need to write your own function, there is no built in way to use it. You can just copy the function from core.trac.wordpress.org/browser/tags/3.1.1/wp-includes/… and then paste that into your functions.php file? I am just learning about this myself –  weston deboer Mar 17 '12 at 17:23
1  
@westondeboer - you don't have to access the function directly, you can add your filters to it and then call next_post_link as you normally would, which will then call get_adjacent_post, applying your filters to the query. –  Milo Mar 17 '12 at 17:49

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.