Thanks, actually, I figured it out; I had to use $post->ID, as $post_id gave me the same date for all posts.
And I used a different concatenation method to put the date first:
function add_post_object_date( $title, $post, $field, $post_id ) {
$post_date = get_the_date( 'j F Y - ',$post->ID);
$date_title = "$post_date $title";
return $date_title;
}
add_filter('acf/fields/post_object/result', 'add_post_object_date', 10, 4);
And FYI for anyone else reading, this sorts the post objects by date in the backend:
add_filter( 'acf/fields/post_object/query', 'change_posts_order' );
function change_posts_order( $args ) {
$args['orderby'] = 'date';
$args['order'] = 'DESC';
return $args;
Exactly what I need; thanks!
Thanks! Will have to read those links and try them out.
Nope, the code tags don’t allow entities to be posted. Must be a limited Tiny-MCE editor.
Yes, html entities work in the Instructions fields; thanks. I should have tried that. HTML like break tags work.
The code tags in the forum editor should work to be able to post entities without converting them, like this:
< for < arrow and > for right arrow.
Ouch, typo: title should be Show instead of Shoe.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.