Change date format on frontend
-
Just started using Metabox and I’m trying to change the date format on the front end of my website. I’ve tried
$event_begin = rwmb_meta( 'date_1' ); echo date( 'd F, Y', strtotime( $date_1 ) );
However it just inserts the date into the top of my web site instead of changing the date in the correct areas.
I’ve inserted the date with the following shortcode
[rwmb_meta meta_key="date_1" type="date"]
My code for the meta box is
function date_metabox( $meta_boxes ) { $prefix = ''; $meta_boxes[] = array( 'id' => 'event-date', 'title' => esc_html__( 'Event Date', 'Custom Meta Box' ), 'post_types' => array( 'post' ), 'context' => 'advanced', 'priority' => 'default', 'autosave' => false, 'fields' => array( array( 'id' => $prefix . 'date_1', 'type' => 'date', 'name' => esc_html__( 'Date Picker', 'Custom Meta Box' ), 'class' => ‘meta-date’, 'inline' => true, ), ), ); return $meta_boxes; } add_filter( 'rwmb_meta_boxes', 'date_metabox' );
Any help would be greatly appreciated.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Change date format on frontend’ is closed to new replies.