Hello @edwinkort
Sorry about the delayed response, it took me a while figure this one out. You can try the code below.
function wzy_change_sort_order( $query ) {
if ( is_tax( 'rcno_series' ) ) {
// @see https://developer.ww.wp.xz.cn/reference/classes/wp_query/#order-orderby-parameters
$query->set( 'order', 'DESC' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'rcno_book_series_number' );
}
}
add_action( 'pre_get_posts', 'wzy_change_sort_order' );
Also, I can make no guarantee on how it will work with decimals as that is a function of how WordPress itself works.
I believe this need to be placed somewhere in one of the themes php files?
You’d add it to your theme’s functions.php file.
When I add this to functions.php it doesn’t work. Unfrotuantely
I am now confused as to what it is you’re asking.
I just checked your website and the series taxonomy archive page is being correctly sorted by series number in descending order.
Strange. On my browser(s) it all looks as if nothing has changed.
Going to https://edwinleest.ddns.net/wordpress/index.php/recensies/series/lux/ the books are sorted in the order I’ve read them.
Maybe I should have the function set ASCending istead of DESCending?
Jsut to make it clear, I don’t mean this thab https://edwinleest.ddns.net/wordpress/index.php/series/
-
This reply was modified 4 years, 8 months ago by
edwinkort.
Did you try changing the sort order?
Yes, changed it from DESC to ASC. in function.php
Do that resolve this request?
o.. Yes. Sorry, forgot to mention this. Was too busy earlier.