WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
Custom post Meta Date Format (2 posts)

  1. dustykhan
    Member
    Posted 8 months ago #

    I am using this code to get a custom field with a date stored withing the contact form 7 plugin, generated by the 'advanced custom fields' plugin:

    elseif ( '_post_event_date' == $name )
        		$output = get_post_meta($post->ID, 'event_date', true);

    This gets the date and displays it as "20140131" within the sent email but I need it formatted as "Friday, January 31st, 2014", but I can seem to get this to work.

    Here is what I have tried, but does not work:

    elseif ( '_post_event_date' == $name )
        		$output = get_post_meta($post->ID, 'event_date', true);
        esc_html_e( date_i18n( 'l, F jS, Y' , strtotime( $event_date ) ) );

    http://wordpress.org/plugins/advanced-custom-fields/

  2. domokun
    Member
    Posted 6 months ago #

    I don't think you need the strtotime as the date is already in standard date format YYYMMDD

    Just try using
    date( 'l, F jS, Y' , $event_date )

Reply

You must log in to post.

About this Plugin

About this Topic