get_post_meta() name

This topic contains 1 reply, has 2 voices, and was last updated by  Kiran 5 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #503000

    Barbara Magee
    Expired Member
    Post count: 146

    Hello!
    Would you help us with the get_post_meta() name for event start date?We’re trying to set up a new page that pulls events by ID and displays the thumbnail, event title and event start date using a 3rd party plugin.

    Thanks!

    #503056

    Kiran
    Moderator
    Post count: 7069

    Hi Barbara,

    At the moment there is no meta key name for event start_date. To show event dates it has event_dates meta key which shows start date time & end date time. But sorry at the moment no separate key to show start_date.

    We have already task in our todo to allow show start date, end date, start time & end time. It will be in one of future version.

    Right now to achieve that you want do following things.

    1) Add following PHP snippet via plugin or theme functions.php file

    
    
    function gd_snippet_190814_output_event_dates( $output, $find_post, $args ) {
    	global $post;
    
    	$the_post = ! empty( $find_post->start_date ) ? $find_post : ( ! empty( $post ) && ! empty( $post->start_date ) && $post->ID == $find_post->ID ? $post : NULL );
    
    	if ( ! empty( $the_post ) && ! empty( $the_post->start_date ) && strpos( $args['badge'], '%%event_' ) !== false ) {
    		$date_format = geodir_event_date_format();
    		$time_format = geodir_event_time_format();
    
    		$output = $args['badge'];
    		$output = str_replace( '%%event_start_date%%', date_i18n( $date_format, strtotime( $the_post->start_date ) ), $output );
    		$output = str_replace( '%%event_end_date%%', date_i18n( $date_format, strtotime( $the_post->end_date ) ), $output );
    		$output = str_replace( '%%event_start_time%%', date_i18n( $time_format, strtotime( $the_post->start_time ) ), $output );
    		$output = str_replace( '%%event_end_time%%', date_i18n( $time_format, strtotime( $the_post->end_time ) ), $output );
    	}
    
    	return $output;
    }
    add_filter( 'geodir_output_badge_field_key_event_dates', 'gd_snippet_190814_output_event_dates', 20, 3 );

    2) Use following shortcodes.

    
    
    - For start date: [gd_post_badge key="event_dates" condition="is_not_empty" badge="%%event_start_date%%" bg_color="#ffffff" txt_color="#1339f0" alignment="center"]
    - For end date: [gd_post_badge key="event_dates" condition="is_not_empty" badge="%%event_end_date%%" bg_color="#ffffff" txt_color="#1339f0" alignment="center"]
    - For start time: [gd_post_badge key="event_dates" condition="is_not_empty" badge="%%event_start_time%%" bg_color="#ffffff" txt_color="#1339f0" alignment="center"]
    - For end time: [gd_post_badge key="event_dates" condition="is_not_empty" badge="%%event_end_time%%" bg_color="#ffffff" txt_color="#1339f0" alignment="center"]

    Kiran

Viewing 2 posts - 1 through 2 (of 2 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount