I’ve basically two issues:
First of all, I’m using pre_get_posts on the archive page and I’d like to show all posts on that page rather than having pagination – however, I cannot get it to work – this is what I’m basically using: $query->set( ‘posts_per_page’, -1 );
Second, I’d like to sort the posts on the page based on the values of two different custom fields – one is numeric, the other one is not – how can I do that?
Hope somebody can help.
$query->set('posts_per_page', -1); should be correct.
Sorting by 2 meta field, until quite recently was not really possible, or at best difficult. However, WP 4.2 introduced and improvement that will allow this. See this: https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/