I am using the More Fields and More Types plugins to create a custom post type called product
. This custom type is based on the Post type.
One of the fields is named lot
which is an integer representing a Lot # for an auction.
I created a custom category page which generates a list of links for each Lot, ordered by the lot
field. This works great.
$args = array(
'post_type' => array('product'),
'cat' => 3,
'meta_key' => 'lot',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
However… when you click on one of the lots, the Previous & Next post links aren’t ordered by the lot
field anymore, they are ordered by publish date (which is the WP default). I am trying to figure out how I can change this default sort order for previous_post_link()
and next_post_link()
to use custom field lot
instead of Publish date.
You can filter SQL to change to your condition in
get_adjacent_post()
( source ) :Or filter link altogether in
adjacent_post_link()
( source ) :PS
$adjacent
can benext
orprevious
.