My CPT ‘publication’ has fields including
- hps_page_number
- hps_edition_number
I have a regular page with a looper provider with this query string: post_type=publication&orderby=meta_value_num&meta_key=hps_page_number&order=asc
It pulls posts from a CPT called publication and sorts them by page number - this is working.
I want to pass a URL into the page such as ?edition=47 and filter the looper provider results, e.g.:
post_type=publication&orderby=meta_value_num&meta_key=hps_page_number&order=asc&hps_edition_number={{dc:url:param key=“edition”}}
or {{dc:term:meta key=“hps_edition_number”}}={{dc:url:param key=“edition”}}
or {{dc:acf:post_field field=“hps_edition_number”}}={{dc:url:param key=“edition”}}7
I got help from the Facebook group and this is the string that works.
post_type=publication&orderby=meta_value_num&meta_key=hps_page_number&order=asc&meta_query[0][key]=hps_edition_number&meta_query[0][value]={{dc:url:param key=“edition” fallback=“46”}}&meta_query[0][compare]==&meta_query[relation]=AND
This means I can simulate an archive layout but with sorting, and parameterise the page using the input URL.
No need for help but this might provide a guide for visitors from the future.