Support

Account

Home Forums Front-end Issues The datepicker field of the post type it is relationship to is not showing

Helping

The datepicker field of the post type it is relationship to is not showing

  • I want to show the datepicker field of the post type it is associated with in cpt, but it is not working.

    Event post type has “Start date” and “End date” fields.
    On the Season post type single page, I list the event post type and I want to show the dates.

    I am using the following example:

    <?php 
    
    // Load field value.
    $start_date = strtotime (get_field('start_date'));
    $end_date = strtotime (get_field('end_date'));
    
    ?>
    <h4><?php echo date_i18n( "F j", $start_date ); ?> - <?php echo date_i18n( "F j", $start_date ); ?></h4>
    <p><?php echo date_i18n( "H:i", $end_date ); ?> - <?php echo date_i18n( "H:i", $end_date ); ?></p>
  • You need to supply the post ID of the post you want to get the value from

    
    $value = get_field('field_name', $event_post->ID);
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.