• iueweb

    (@iueweb)


    Hello!

    Thanks for the great plugin! I’ve created a custom date field (on a custom post type) with the help of the Advanced Custom Fields plugin. I’ve added that field to a Query Wrangler query, but it shows up in the default raw ACF ‘Save format’ (yymmdd). I would like it to show up in the more friendly ACF ‘Display format’ instead if possible. On the query, I’ve edited the field’s Display Handler to use ‘Advanced Custom Fields: get_field’ in case that would help., but no luck. Is there a way to get it to show up in the ACF ‘Display format’, and if not, what would be the best way to format the raw date value? I’m happy to use php, but I’d appreciate a suggestion on the best way to hook into the query.

    Thanks! Happy Thanksgiving!

    FYI: I’m actually using WP 3.9.3 (wasn’t an option in the Version dropdown), ACF 4.3.9, Custom Post Type UI 0.8.5, and Query Wrangler 1.5.25.

    https://www.ads-software.com/plugins/query-wrangler/

Viewing 1 replies (of 1 total)
  • Hi

    I see you have not received an answer although the post is 3 months old. I wrestled with this for a long time too. Do this…..

    In your Query Wrangler add the field like ‘start_date’ you want to return and exclude it from the display. Create a callback field called ‘my_custom_date’ – tick the box “include additional information”.

    Then in your functions.php add:

    /* Change the date format of ACF ‘start_date’ */
    function my_custom_date($post, $field, $tokens){
    $date = DateTime::createFromFormat(‘Ymd’, ($tokens[‘{{meta_start_date}}’])); echo $date->format(‘F d, Y’);
    }

    You can format the date to your linking in the echo.

Viewing 1 replies (of 1 total)
  • The topic ‘ACF Integration: Use Display format of Date Field in QW’ is closed to new replies.