I have a Craft CMS 4 website with an entry query that's displaying results in order of priority (1, 2, 3 or 4) and sub priority (1, 2 or 3). I've assigned these numbers to the entries via entry fields. This works well but now I've introduced paid memberships. Users who pay will get automatically added to a user group called paidMembership. I now need to amend my entry query to show the listings that belong to those members higher up - ideally in between priority 1 and 2. What's the simplest way to do this? Here's my code, note that the results are paginating, showing 15 results per page and results randomise within their priority groups:

{% set newsQuery = craft.entries().section(sectionTitle).orderBy('priority, subPriority, RAND()').limit(15) %}

{# Paginate the query into a posts variable: #}
{% paginate newsQuery as pageInfo, posts %}

{% include "_includes/listing.twig"  with { posts: posts, pageInfo: pageInfo } only %}
  • Hi George, to clarify... You want the end results to be: Priority 1, Priority 2, Paid Authors, Priority 3.... correct?
    – cherrykoda
    Commented Aug 23, 2023 at 1:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.