Sorting Alphabetically In Looper Provider Dynamic Content


I have a Looper Provider which is generating all the expected results perfectly using dynamic content. The statement is {{dc:acf:post_field field="memorial_casualties"}}. However, the results are being displayed in random order. Is it possible to add an order statement into the DC so that the output is alphabetically sorted?


Hi @whitemedia,

Regretfully, there is no such option in Dynamic Content for sorting.


Thanks. I thought that might be the case. Are there any other options for sorting this data using a different method of bringing it through the looper provider?


Hey Christopher,

You can use query string to add sorting for your loopers. Here’s the documentation on how you can achieve it.

Hope that helps.

Hi @marc_a,

Thanks for the tip. How can I bring through an ACF field using a query string though, so the results can be sorted alphabetically? I have had a look at the links you sent but have got myself thoroughly muddled! My current dynamic content string is {{dc:acf:post_field field="memorial_casualties"}}

Additionally, (I have a similar scenario elsewhere) if I were to use a query string for a CPT taxonomy, what would I use in place of the category_name-.... Would it be taxonomy_name=....?

Other details in the secure note.

Many thanks,

Hello @whitemedia,

You are using the Looper Provider Dynamic Content. Be advised that the order of the items in the Looper Consumer will be based on whatever is returned by the provider. In your case, you have {{dc:acf:post_field field="memorial_casualties"}}. This means that whatever order is saved in the ACF field is the same order being returned by the looper.

Since the ACF field is a Relationship, you will have to edit each of the Memorial and make sure to reorder the Casualties manually.

Thank you for your understanding.

Hi @Ruenel,

Thanks for the reply. I understand what you are saying, but the practicalities of manually sorting the field memorial_casualties is not realistic, due to the large amount of data - currently 17k+ entries, which will only grow.

I am using a Dynamic Content statement in the Looper Provider having followed @marc_a’s help in this post: ACF Pro Relationship Field Not Displaying

However, I understand from @marc_a in reply 4 above (Sorting Alphabetically In Looper Provider Dynamic Content) that the Looper Provider can use a Query String instead of Dynamic Content to achieve the desired results - the content sorted alphabetically.

I am new to Query Strings, so am fumbling in the dark a bit! I think the correct string may be post_type=memorial&post_status=publish&order=ASC&orderby=meta_value&meta_key=memorial_casualties, but it does not output the expected results, i.e. a list of Casualties associated with the Memorial.

My current structure is like this:

  • DIV (Looper Provider)
    – DIV (<a> with content = {{dc:post:permalink}} for hyperlinking)
    — Text Element (content = {{dc:post:title}}{{dc:acf:post_field field="memorial_casualties"}})

If my WP Query string is correct, does the Text Elementneed different content?

Thank you for all your help,

Hello There,

Your query string is incorrect. You are in the Memorial single layout. Therefore, you will be querying “Casualties” and using the relation between casualty and memorial. Take this query argument for example:

$meta_query[] = array(
    'key' => 'casualty_memorial_casualties',
    'value' => '{{dc:post:id}}',
    'compare' => 'LIKE'

$args = array(
  'post_type' => 'casualty',
  'orderby'    => 'title',
  'order'      => 'ASC',
  'meta_query' => $meta_query

And this will give you:

The final result will be something like:

Hope this helps.

Hi @ruenel,

Thank you and @marc_a for your help on this topic. It has been a massive help!

Many thanks,

1 Like