Post pagination links ordered by meta value

Question

Is there a way to order the nex-previous post links, or any other pagination function to get the links ordered by meta value, like I have done in the posts listing page shown below?

$events = get_posts(array(
    'posts_per_page' => -1,
    'post_type' => 'post',
    'meta_key'  => 'date_time',
    'orderby'   => 'meta_value',
    'order'     => 'ASC',
    'suppress_filters' => false
));

The main goal is tho have the next, – previous event buttons in chronological order in the single post page. (not the post date, but the event date that is stored in custom fields)

0
Botond Vajna 4 months 0 Answers 13 views 0

Leave an answer