Sort display by ACF date field

Hi there, I have a page with recent media items in which the client can upload new items such as radio, videos, or images.

It’s fairly simple in that it’s all done through ACF repeater fields in just the Media page with several sub-selectors within the repeater. It’s then added to the page through loopers and consumers. (no custom post types)

The trouble I’m having is getting it to sort by the ‘date’ ACF field. It tends to display from oldest to newest, but I need them showing from newest to oldest based on the date selected. You can see the date below the title for each block here:

I’d be happy to provide access if you need to take a closer look at the setup.

Thanks for your help!

Cheers,
David

Hi David,

Thanks for reaching out.
I have checked your website and found that the Media posts are not ordered as per your requirement. It might be ordered by Post ID or the Date of Publish. It will be very difficult to recognize the reason behind the problem without investigating through the WordPress admin dashboard. I would suggest you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Hi @tristup thanks for the response. I’ve sent you a secure note.
Looking forward to hearing your suggestion!

Cheers,
David

Hey David,

You’re using the Dynamic Content Looper and there’s currently no ordering feature for it. The ordering option for ACF would be to manually order the whole ACF entry by drag and dropping as shown in the screenshot below.

By the way, the Order By Looper Feature is only available in the Query Builder and can only be used for Post Types.

Hi @christian Thanks for that. It’s a bit annoying for the client as the upload new item button is at the bottom and if she has 100 items then that’s a lot of work to drag it all the way to the top.

Are there any other alternatives with this type of setup besides creating a custom post type?
If not that’s okay, it is what it is.

Cheers,
David

Hey David,

I understand. Regretfully, there’s currently no way to order ACF items based on an ACF field.

I’ll add this as a feature request so this might be taken into account for future developments.

1 Like

Thanks @christian I appreciate that.

Cheers,
David

Hi David,

You are most welcome.

Hi, sorry for continuing this thread but I’m having another issue with this. I’ve changed the process to pull from posts within a custom post type instead of having it pulling form acf fields on the same page. And that works fine…

But now the uploaded audio files aren’t working? I’ve set ACF to display the file URL but when I add the acf dynamic content to the audio element it just displays the media ID.

For example the src is https://280 instead of the file url.

Any idea why this is happening?

You can see it in the audio players here: https://jorkconsulting.com/media/

Cheers,
David

Hi Claudio,

The issue I am seeing right on your setup is your dynamic content, you use this one {{dc:post:meta key="radio_audio_file"}} but the correct dynamic content in calling the ACF field is this one {{dc:acf:post_field field="radio_audio_file"}}.

Hope that helps.

Hi @marc_a thanks so much, that fixed it. Could you tell me why that works and not the post:meta?

As far as I can tell if I use {{dc:acf:post_field field=""}} it works with everything on the page but {{dc:post:meta key=""}} only works with some things.

ALSO I have a solution to the custom ordering by ACF fields as I previously asked!

I used a query string as the provider with the following values:
post_type=media_items&post_status=publish&orderby=meta_value&meta_key=date_picker&order=desc

This was suggested to me by Josh Donnelly in the X Theme Facebook Group

image

Just FYI for next time if this issue comes up again.

Cheers,
David

1 Like

Hi David,

Glad you sorted things out and thank you for sharing that.

Cheers,

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.