Home Forums ACF PRO CPT Archive Page


CPT Archive Page

  • Hello
    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:

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.